
(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 8 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 (+ (* (/ (fma v 0.25 -0.375) (- 1.0 v)) (pow (* r w) 2.0)) (fma 2.0 (pow r -2.0) -1.5)))
double code(double v, double w, double r) {
return ((fma(v, 0.25, -0.375) / (1.0 - v)) * pow((r * w), 2.0)) + fma(2.0, pow(r, -2.0), -1.5);
}
function code(v, w, r) return Float64(Float64(Float64(fma(v, 0.25, -0.375) / Float64(1.0 - v)) * (Float64(r * w) ^ 2.0)) + fma(2.0, (r ^ -2.0), -1.5)) end
code[v_, w_, r_] := N[(N[(N[(N[(v * 0.25 + -0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[Power[N[(r * w), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[Power[r, -2.0], $MachinePrecision] + -1.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(v, 0.25, -0.375\right)}{1 - v} \cdot {\left(r \cdot w\right)}^{2} + \mathsf{fma}\left(2, {r}^{-2}, -1.5\right)
\end{array}
Initial program 81.3%
sub-neg81.3%
+-commutative81.3%
associate--l+81.3%
associate-/l*81.3%
distribute-neg-frac81.3%
associate-/r/81.3%
fma-def81.3%
sub-neg81.3%
Simplified81.3%
fma-udef81.3%
unswap-sqr99.8%
pow299.8%
div-inv99.8%
fma-def99.8%
pow299.8%
pow-flip99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 5e-114)
t_0
(+
t_0
(- -1.5 (* (/ (+ 0.375 (* v -0.25)) (- 1.0 v)) (* r (* r (* w w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 5e-114) {
tmp = t_0;
} else {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 5d-114) then
tmp = t_0
else
tmp = t_0 + ((-1.5d0) - (((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)) * (r * (r * (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 (r <= 5e-114) {
tmp = t_0;
} else {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 5e-114: tmp = t_0 else: tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 5e-114) tmp = t_0; else tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v)) * Float64(r * Float64(r * Float64(w * w)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 5e-114) tmp = t_0; else tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (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[r, 5e-114], t$95$0, N[(t$95$0 + N[(-1.5 - N[(N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 5 \cdot 10^{-114}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{1 - v} \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 4.99999999999999989e-114Initial program 78.1%
sub-neg78.1%
+-commutative78.1%
associate--l+78.1%
associate-/l*78.1%
distribute-neg-frac78.1%
associate-/r/78.1%
fma-def78.1%
sub-neg78.1%
Simplified78.1%
fma-udef78.1%
unswap-sqr99.9%
pow299.9%
div-inv99.9%
fma-def99.9%
pow299.9%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in r around 0 90.7%
unpow290.7%
Simplified90.7%
if 4.99999999999999989e-114 < r Initial program 91.9%
associate--l-91.9%
+-commutative91.9%
associate--l+91.9%
+-commutative91.9%
associate--r+91.9%
metadata-eval91.9%
associate-*l/91.9%
*-commutative91.9%
*-commutative91.9%
*-commutative91.9%
Simplified91.9%
Final simplification91.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 6.8e-117)
t_0
(+
t_0
(- -1.5 (* (/ (+ 0.375 (* v -0.25)) (- 1.0 v)) (* r (* w (* r w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 6.8e-117) {
tmp = t_0;
} else {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (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 (r <= 6.8d-117) then
tmp = t_0
else
tmp = t_0 + ((-1.5d0) - (((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)) * (r * (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 (r <= 6.8e-117) {
tmp = t_0;
} else {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (w * (r * w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 6.8e-117: tmp = t_0 else: tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (w * (r * w))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 6.8e-117) tmp = t_0; else tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v)) * Float64(r * Float64(w * Float64(r * w)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 6.8e-117) tmp = t_0; else tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (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[LessEqual[r, 6.8e-117], t$95$0, N[(t$95$0 + N[(-1.5 - N[(N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 6.8 \cdot 10^{-117}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{1 - v} \cdot \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 6.80000000000000069e-117Initial program 78.1%
sub-neg78.1%
+-commutative78.1%
associate--l+78.1%
associate-/l*78.1%
distribute-neg-frac78.1%
associate-/r/78.1%
fma-def78.1%
sub-neg78.1%
Simplified78.1%
fma-udef78.1%
unswap-sqr99.9%
pow299.9%
div-inv99.9%
fma-def99.9%
pow299.9%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in r around 0 90.7%
unpow290.7%
Simplified90.7%
if 6.80000000000000069e-117 < r Initial program 91.9%
associate--l-91.9%
+-commutative91.9%
associate--l+91.9%
+-commutative91.9%
associate--r+91.9%
metadata-eval91.9%
associate-*l/91.9%
*-commutative91.9%
*-commutative91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in r around 0 91.9%
unpow291.9%
associate-*l*96.6%
Simplified96.6%
Final simplification92.1%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* (* w (* w (* r r))) (/ (+ 0.375 (* v -0.25)) (- 1.0 v))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - ((w * (w * (r * r))) * ((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) - ((w * (w * (r * r))) * ((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 - ((w * (w * (r * r))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - ((w * (w * (r * r))) * ((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(w * Float64(w * Float64(r * r))) * 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 - ((w * (w * (r * r))) * ((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[(w * N[(w * N[(r * r), $MachinePrecision]), $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(w \cdot \left(w \cdot \left(r \cdot r\right)\right)\right) \cdot \frac{0.375 + v \cdot -0.25}{1 - v}\right)
\end{array}
Initial program 81.3%
associate--l-81.3%
+-commutative81.3%
associate--l+81.3%
+-commutative81.3%
associate--r+81.3%
metadata-eval81.3%
associate-*l/81.3%
*-commutative81.3%
*-commutative81.3%
*-commutative81.3%
Simplified81.3%
add-cube-cbrt81.3%
pow381.3%
associate-*r*81.3%
unswap-sqr99.7%
pow299.7%
Applied egg-rr99.7%
rem-cube-cbrt99.8%
unpow-prod-down81.3%
pow281.3%
pow281.3%
*-commutative81.3%
associate-*l*99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (let* ((t_0 (/ 2.0 (* r r)))) (if (<= r 4.5e-113) t_0 (+ t_0 (- (* -0.375 (* (* r r) (* w w))) 1.5)))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 4.5e-113) {
tmp = t_0;
} else {
tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.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 (r <= 4.5d-113) then
tmp = t_0
else
tmp = t_0 + (((-0.375d0) * ((r * r) * (w * w))) - 1.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 (r <= 4.5e-113) {
tmp = t_0;
} else {
tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 4.5e-113: tmp = t_0 else: tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 4.5e-113) tmp = t_0; else tmp = Float64(t_0 + Float64(Float64(-0.375 * Float64(Float64(r * r) * Float64(w * w))) - 1.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 4.5e-113) tmp = t_0; else tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 4.5e-113], t$95$0, N[(t$95$0 + N[(N[(-0.375 * N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 4.5 \cdot 10^{-113}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-0.375 \cdot \left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) - 1.5\right)\\
\end{array}
\end{array}
if r < 4.5000000000000001e-113Initial program 78.1%
sub-neg78.1%
+-commutative78.1%
associate--l+78.1%
associate-/l*78.1%
distribute-neg-frac78.1%
associate-/r/78.1%
fma-def78.1%
sub-neg78.1%
Simplified78.1%
fma-udef78.1%
unswap-sqr99.9%
pow299.9%
div-inv99.9%
fma-def99.9%
pow299.9%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in r around 0 90.7%
unpow290.7%
Simplified90.7%
if 4.5000000000000001e-113 < r Initial program 91.9%
sub-neg91.9%
+-commutative91.9%
associate--l+91.9%
associate-/l*92.0%
distribute-neg-frac92.0%
associate-/r/91.9%
fma-def91.9%
sub-neg91.9%
Simplified92.0%
Taylor expanded in v around 0 90.7%
associate--l+90.7%
associate-*r/90.7%
metadata-eval90.7%
unpow290.7%
*-commutative90.7%
unpow290.7%
unpow290.7%
Simplified90.7%
Final simplification90.7%
(FPCore (v w r) :precision binary64 (+ -1.5 (/ 2.0 (* r r))))
double code(double v, double w, double r) {
return -1.5 + (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 = (-1.5d0) + (2.0d0 / (r * r))
end function
public static double code(double v, double w, double r) {
return -1.5 + (2.0 / (r * r));
}
def code(v, w, r): return -1.5 + (2.0 / (r * r))
function code(v, w, r) return Float64(-1.5 + Float64(2.0 / Float64(r * r))) end
function tmp = code(v, w, r) tmp = -1.5 + (2.0 / (r * r)); end
code[v_, w_, r_] := N[(-1.5 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 + \frac{2}{r \cdot r}
\end{array}
Initial program 81.3%
sub-neg81.3%
+-commutative81.3%
associate--l+81.3%
associate-/l*81.3%
distribute-neg-frac81.3%
associate-/r/81.3%
fma-def81.3%
sub-neg81.3%
Simplified81.3%
Taylor expanded in r around 0 85.6%
sub-neg85.6%
associate-*r/85.6%
metadata-eval85.6%
unpow285.6%
metadata-eval85.6%
Simplified85.6%
Final simplification85.6%
(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 81.3%
sub-neg81.3%
+-commutative81.3%
associate--l+81.3%
associate-/l*81.3%
distribute-neg-frac81.3%
associate-/r/81.3%
fma-def81.3%
sub-neg81.3%
Simplified81.3%
fma-udef81.3%
unswap-sqr99.8%
pow299.8%
div-inv99.8%
fma-def99.8%
pow299.8%
pow-flip99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in r around 0 83.2%
unpow283.2%
Simplified83.2%
Final simplification83.2%
(FPCore (v w r) :precision binary64 -1.5)
double code(double v, double w, double r) {
return -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 = -1.5d0
end function
public static double code(double v, double w, double r) {
return -1.5;
}
def code(v, w, r): return -1.5
function code(v, w, r) return -1.5 end
function tmp = code(v, w, r) tmp = -1.5; end
code[v_, w_, r_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 81.3%
sub-neg81.3%
+-commutative81.3%
associate--l+81.3%
associate-/l*81.3%
distribute-neg-frac81.3%
associate-/r/81.3%
fma-def81.3%
sub-neg81.3%
Simplified81.3%
Taylor expanded in r around 0 85.6%
sub-neg85.6%
associate-*r/85.6%
metadata-eval85.6%
unpow285.6%
metadata-eval85.6%
Simplified85.6%
Taylor expanded in r around inf 2.5%
Final simplification2.5%
herbie shell --seed 2023278
(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))