
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* (* (* r w) (* r w)) (/ (+ 0.375 (* v -0.25)) (- 1.0 v))))))
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))));
}
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
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))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * ((0.375 + (v * -0.25)) / (1.0 - v))))
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
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
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}
\\
\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 88.7%
associate--l-88.7%
+-commutative88.7%
associate--l+88.7%
+-commutative88.7%
associate--r+88.7%
metadata-eval88.7%
associate-*l/91.6%
*-commutative91.6%
*-commutative91.6%
*-commutative91.6%
Simplified91.6%
add-cube-cbrt91.5%
pow391.5%
associate-*r*85.3%
unswap-sqr99.6%
pow299.6%
Applied egg-rr99.6%
rem-cube-cbrt99.8%
unpow299.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)) (- 1.0 v)) (* r (* w (* 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 * (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 * (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 * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (w * (r * w)))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v)) * Float64(r * Float64(w * Float64(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 * (r * w))))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 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}
\\
\frac{2}{r \cdot r} + \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}
Initial program 88.7%
associate--l-88.7%
+-commutative88.7%
associate--l+88.7%
+-commutative88.7%
associate--r+88.7%
metadata-eval88.7%
associate-*l/91.6%
*-commutative91.6%
*-commutative91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in r around 0 91.6%
unpow291.6%
associate-*l*98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (* (* r w) (* r w))))
(if (<= v 2.3e-10)
(+ t_0 (- -1.5 (* t_1 0.375)))
(+ t_0 (+ -1.5 (* t_1 (- (/ 0.125 v) 0.25)))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (r * w) * (r * w);
double tmp;
if (v <= 2.3e-10) {
tmp = t_0 + (-1.5 - (t_1 * 0.375));
} else {
tmp = t_0 + (-1.5 + (t_1 * ((0.125 / v) - 0.25)));
}
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 = 2.0d0 / (r * r)
t_1 = (r * w) * (r * w)
if (v <= 2.3d-10) then
tmp = t_0 + ((-1.5d0) - (t_1 * 0.375d0))
else
tmp = t_0 + ((-1.5d0) + (t_1 * ((0.125d0 / v) - 0.25d0)))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (r * w) * (r * w);
double tmp;
if (v <= 2.3e-10) {
tmp = t_0 + (-1.5 - (t_1 * 0.375));
} else {
tmp = t_0 + (-1.5 + (t_1 * ((0.125 / v) - 0.25)));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = (r * w) * (r * w) tmp = 0 if v <= 2.3e-10: tmp = t_0 + (-1.5 - (t_1 * 0.375)) else: tmp = t_0 + (-1.5 + (t_1 * ((0.125 / v) - 0.25))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(Float64(r * w) * Float64(r * w)) tmp = 0.0 if (v <= 2.3e-10) tmp = Float64(t_0 + Float64(-1.5 - Float64(t_1 * 0.375))); else tmp = Float64(t_0 + Float64(-1.5 + Float64(t_1 * Float64(Float64(0.125 / v) - 0.25)))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = (r * w) * (r * w); tmp = 0.0; if (v <= 2.3e-10) tmp = t_0 + (-1.5 - (t_1 * 0.375)); else tmp = t_0 + (-1.5 + (t_1 * ((0.125 / v) - 0.25))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, 2.3e-10], N[(t$95$0 + N[(-1.5 - N[(t$95$1 * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(t$95$1 * N[(N[(0.125 / v), $MachinePrecision] - 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
\mathbf{if}\;v \leq 2.3 \cdot 10^{-10}:\\
\;\;\;\;t_0 + \left(-1.5 - t_1 \cdot 0.375\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 + t_1 \cdot \left(\frac{0.125}{v} - 0.25\right)\right)\\
\end{array}
\end{array}
if v < 2.30000000000000007e-10Initial program 88.8%
associate--l-88.8%
+-commutative88.8%
associate--l+88.8%
+-commutative88.8%
associate--r+88.8%
metadata-eval88.8%
associate-*l/90.2%
*-commutative90.2%
*-commutative90.2%
*-commutative90.2%
Simplified90.2%
add-cube-cbrt90.1%
pow390.1%
associate-*r*84.4%
unswap-sqr99.6%
pow299.6%
Applied egg-rr99.6%
rem-cube-cbrt99.8%
unpow299.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 98.1%
if 2.30000000000000007e-10 < v Initial program 88.3%
associate--l-88.3%
+-commutative88.3%
associate--l+88.3%
+-commutative88.3%
associate--r+88.3%
metadata-eval88.3%
associate-*l/96.4%
*-commutative96.4%
*-commutative96.4%
*-commutative96.4%
Simplified96.4%
add-cube-cbrt96.4%
pow396.4%
associate-*r*88.0%
unswap-sqr99.8%
pow299.8%
Applied egg-rr99.8%
rem-cube-cbrt99.9%
unpow299.9%
Applied egg-rr99.9%
Taylor expanded in v around inf 99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification98.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= (* w w) 2.75e-154)
(+ t_0 -1.5)
(+ t_0 (* (* r r) (* -0.25 (* w w)))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 2.75e-154) {
tmp = t_0 + -1.5;
} else {
tmp = t_0 + ((r * r) * (-0.25 * (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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((w * w) <= 2.75d-154) then
tmp = t_0 + (-1.5d0)
else
tmp = t_0 + ((r * r) * ((-0.25d0) * (w * 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 * w) <= 2.75e-154) {
tmp = t_0 + -1.5;
} else {
tmp = t_0 + ((r * r) * (-0.25 * (w * w)));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (w * w) <= 2.75e-154: tmp = t_0 + -1.5 else: tmp = t_0 + ((r * r) * (-0.25 * (w * w))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(w * w) <= 2.75e-154) tmp = Float64(t_0 + -1.5); else tmp = Float64(t_0 + Float64(Float64(r * r) * Float64(-0.25 * Float64(w * w)))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((w * w) <= 2.75e-154) tmp = t_0 + -1.5; else tmp = t_0 + ((r * r) * (-0.25 * (w * w))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(w * w), $MachinePrecision], 2.75e-154], N[(t$95$0 + -1.5), $MachinePrecision], N[(t$95$0 + N[(N[(r * r), $MachinePrecision] * N[(-0.25 * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \cdot w \leq 2.75 \cdot 10^{-154}:\\
\;\;\;\;t_0 + -1.5\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(r \cdot r\right) \cdot \left(-0.25 \cdot \left(w \cdot w\right)\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 2.75000000000000001e-154Initial program 94.4%
sub-neg94.4%
+-commutative94.4%
associate--l+94.4%
associate-/l*96.1%
distribute-neg-frac96.1%
associate-/r/96.1%
fma-def96.1%
sub-neg96.1%
Simplified81.7%
Taylor expanded in r around 0 87.1%
sub-neg87.1%
associate-*r/87.1%
metadata-eval87.1%
unpow287.1%
metadata-eval87.1%
Simplified87.1%
if 2.75000000000000001e-154 < (*.f64 w w) Initial program 84.2%
associate--l-84.2%
+-commutative84.2%
associate--l+84.2%
+-commutative84.2%
associate--r+84.2%
metadata-eval84.2%
associate-*l/88.1%
*-commutative88.1%
*-commutative88.1%
*-commutative88.1%
Simplified88.1%
add-cube-cbrt88.0%
pow388.0%
associate-*r*88.0%
unswap-sqr99.7%
pow299.7%
Applied egg-rr99.7%
rem-cube-cbrt99.8%
unpow299.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 94.9%
Taylor expanded in r around inf 83.1%
unpow283.1%
unpow283.1%
associate-*r*83.1%
Simplified83.1%
Final simplification84.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (* (* r w) (* r w))))
(if (<= v 2.3e-10)
(+ t_0 (- -1.5 (* t_1 0.375)))
(+ t_0 (- -1.5 (* t_1 0.25))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (r * w) * (r * w);
double tmp;
if (v <= 2.3e-10) {
tmp = t_0 + (-1.5 - (t_1 * 0.375));
} else {
tmp = t_0 + (-1.5 - (t_1 * 0.25));
}
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 = 2.0d0 / (r * r)
t_1 = (r * w) * (r * w)
if (v <= 2.3d-10) then
tmp = t_0 + ((-1.5d0) - (t_1 * 0.375d0))
else
tmp = t_0 + ((-1.5d0) - (t_1 * 0.25d0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (r * w) * (r * w);
double tmp;
if (v <= 2.3e-10) {
tmp = t_0 + (-1.5 - (t_1 * 0.375));
} else {
tmp = t_0 + (-1.5 - (t_1 * 0.25));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = (r * w) * (r * w) tmp = 0 if v <= 2.3e-10: tmp = t_0 + (-1.5 - (t_1 * 0.375)) else: tmp = t_0 + (-1.5 - (t_1 * 0.25)) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(Float64(r * w) * Float64(r * w)) tmp = 0.0 if (v <= 2.3e-10) tmp = Float64(t_0 + Float64(-1.5 - Float64(t_1 * 0.375))); else tmp = Float64(t_0 + Float64(-1.5 - Float64(t_1 * 0.25))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = (r * w) * (r * w); tmp = 0.0; if (v <= 2.3e-10) tmp = t_0 + (-1.5 - (t_1 * 0.375)); else tmp = t_0 + (-1.5 - (t_1 * 0.25)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, 2.3e-10], N[(t$95$0 + N[(-1.5 - N[(t$95$1 * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(t$95$1 * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
\mathbf{if}\;v \leq 2.3 \cdot 10^{-10}:\\
\;\;\;\;t_0 + \left(-1.5 - t_1 \cdot 0.375\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 - t_1 \cdot 0.25\right)\\
\end{array}
\end{array}
if v < 2.30000000000000007e-10Initial program 88.8%
associate--l-88.8%
+-commutative88.8%
associate--l+88.8%
+-commutative88.8%
associate--r+88.8%
metadata-eval88.8%
associate-*l/90.2%
*-commutative90.2%
*-commutative90.2%
*-commutative90.2%
Simplified90.2%
add-cube-cbrt90.1%
pow390.1%
associate-*r*84.4%
unswap-sqr99.6%
pow299.6%
Applied egg-rr99.6%
rem-cube-cbrt99.8%
unpow299.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 98.1%
if 2.30000000000000007e-10 < v Initial program 88.3%
associate--l-88.3%
+-commutative88.3%
associate--l+88.3%
+-commutative88.3%
associate--r+88.3%
metadata-eval88.3%
associate-*l/96.4%
*-commutative96.4%
*-commutative96.4%
*-commutative96.4%
Simplified96.4%
add-cube-cbrt96.4%
pow396.4%
associate-*r*88.0%
unswap-sqr99.8%
pow299.8%
Applied egg-rr99.8%
rem-cube-cbrt99.9%
unpow299.9%
Applied egg-rr99.9%
Taylor expanded in v around inf 99.6%
Final simplification98.4%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* (* (* r w) (* r w)) 0.25))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * 0.25));
}
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.25d0))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * 0.25));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * 0.25))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * 0.25)); end
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] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right)
\end{array}
Initial program 88.7%
associate--l-88.7%
+-commutative88.7%
associate--l+88.7%
+-commutative88.7%
associate--r+88.7%
metadata-eval88.7%
associate-*l/91.6%
*-commutative91.6%
*-commutative91.6%
*-commutative91.6%
Simplified91.6%
add-cube-cbrt91.5%
pow391.5%
associate-*r*85.3%
unswap-sqr99.6%
pow299.6%
Applied egg-rr99.6%
rem-cube-cbrt99.8%
unpow299.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 93.2%
Final simplification93.2%
(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 88.7%
sub-neg88.7%
+-commutative88.7%
associate--l+88.7%
associate-/l*91.6%
distribute-neg-frac91.6%
associate-/r/91.6%
fma-def91.6%
sub-neg91.6%
Simplified85.3%
Taylor expanded in r around 0 62.5%
sub-neg62.5%
associate-*r/62.5%
metadata-eval62.5%
unpow262.5%
metadata-eval62.5%
Simplified62.5%
Final simplification62.5%
herbie shell --seed 2023208
(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))