
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (pow (* (* r w) (sqrt (/ (fma v -0.25 0.375) (- 1.0 v)))) 2.0))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - pow(((r * w) * sqrt((fma(v, -0.25, 0.375) / (1.0 - v)))), 2.0));
}
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - (Float64(Float64(r * w) * sqrt(Float64(fma(v, -0.25, 0.375) / Float64(1.0 - v)))) ^ 2.0))) end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[Power[N[(N[(r * w), $MachinePrecision] * N[Sqrt[N[(N[(v * -0.25 + 0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - {\left(\left(r \cdot w\right) \cdot \sqrt{\frac{\mathsf{fma}\left(v, -0.25, 0.375\right)}{1 - v}}\right)}^{2}\right)
\end{array}
Initial program 87.8%
associate--l-87.8%
+-commutative87.8%
associate--l+87.8%
+-commutative87.8%
associate--r+87.8%
metadata-eval87.8%
associate-*l/89.6%
*-commutative89.6%
*-commutative89.6%
*-commutative89.6%
Simplified89.6%
add-sqr-sqrt89.6%
pow289.6%
*-commutative89.6%
sqrt-prod89.5%
+-commutative89.5%
fma-def89.5%
associate-*r*85.9%
unswap-sqr99.4%
sqrt-prod48.7%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 3.85e-31)
(+ (- (+ t_0 3.0) (* 0.375 (* (* r w) (* r w)))) -4.5)
(+
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 <= 3.85e-31) {
tmp = ((t_0 + 3.0) - (0.375 * ((r * w) * (r * w)))) + -4.5;
} 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 <= 3.85d-31) then
tmp = ((t_0 + 3.0d0) - (0.375d0 * ((r * w) * (r * w)))) + (-4.5d0)
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 <= 3.85e-31) {
tmp = ((t_0 + 3.0) - (0.375 * ((r * w) * (r * w)))) + -4.5;
} 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 <= 3.85e-31: tmp = ((t_0 + 3.0) - (0.375 * ((r * w) * (r * w)))) + -4.5 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 <= 3.85e-31) tmp = Float64(Float64(Float64(t_0 + 3.0) - Float64(0.375 * Float64(Float64(r * w) * Float64(r * w)))) + -4.5); 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 <= 3.85e-31) tmp = ((t_0 + 3.0) - (0.375 * ((r * w) * (r * w)))) + -4.5; 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, 3.85e-31], N[(N[(N[(t$95$0 + 3.0), $MachinePrecision] - N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -4.5), $MachinePrecision], 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 3.85 \cdot 10^{-31}:\\
\;\;\;\;\left(\left(t_0 + 3\right) - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right) + -4.5\\
\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 < 3.85000000000000006e-31Initial program 86.9%
sub-neg86.9%
associate-/l*88.9%
cancel-sign-sub-inv88.9%
metadata-eval88.9%
*-commutative88.9%
*-commutative88.9%
metadata-eval88.9%
Simplified88.9%
Taylor expanded in v around 0 84.1%
*-commutative84.1%
unpow284.1%
unpow284.1%
swap-sqr95.5%
unpow295.5%
*-commutative95.5%
Simplified95.5%
unpow295.5%
Applied egg-rr95.5%
if 3.85000000000000006e-31 < r Initial program 90.3%
associate--l-90.3%
+-commutative90.3%
associate--l+90.3%
+-commutative90.3%
associate--r+90.3%
metadata-eval90.3%
associate-*l/91.8%
*-commutative91.8%
*-commutative91.8%
*-commutative91.8%
Simplified91.8%
Final simplification94.6%
(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(r * Float64(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[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot \frac{0.375 + v \cdot -0.25}{1 - v}\right)
\end{array}
Initial program 87.8%
associate--l-87.8%
+-commutative87.8%
associate--l+87.8%
+-commutative87.8%
associate--r+87.8%
metadata-eval87.8%
associate-*l/89.6%
*-commutative89.6%
*-commutative89.6%
*-commutative89.6%
Simplified89.6%
Taylor expanded in r around 0 89.6%
unpow289.6%
associate-*l*98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (v w r) :precision binary64 (if (<= r 1.78e-99) (* 2.0 (/ (/ 1.0 r) r)) (+ (/ 2.0 (* r r)) (- (* (* (* r r) (* w w)) -0.375) 1.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.78e-99) {
tmp = 2.0 * ((1.0 / r) / r);
} else {
tmp = (2.0 / (r * r)) + ((((r * r) * (w * w)) * -0.375) - 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) :: tmp
if (r <= 1.78d-99) then
tmp = 2.0d0 * ((1.0d0 / r) / r)
else
tmp = (2.0d0 / (r * r)) + ((((r * r) * (w * w)) * (-0.375d0)) - 1.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.78e-99) {
tmp = 2.0 * ((1.0 / r) / r);
} else {
tmp = (2.0 / (r * r)) + ((((r * r) * (w * w)) * -0.375) - 1.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.78e-99: tmp = 2.0 * ((1.0 / r) / r) else: tmp = (2.0 / (r * r)) + ((((r * r) * (w * w)) * -0.375) - 1.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.78e-99) tmp = Float64(2.0 * Float64(Float64(1.0 / r) / r)); else tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(Float64(Float64(Float64(r * r) * Float64(w * w)) * -0.375) - 1.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.78e-99) tmp = 2.0 * ((1.0 / r) / r); else tmp = (2.0 / (r * r)) + ((((r * r) * (w * w)) * -0.375) - 1.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.78e-99], N[(2.0 * N[(N[(1.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.78 \cdot 10^{-99}:\\
\;\;\;\;2 \cdot \frac{\frac{1}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(\left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) \cdot -0.375 - 1.5\right)\\
\end{array}
\end{array}
if r < 1.7800000000000001e-99Initial program 86.5%
sub-neg86.5%
associate-/l*88.6%
cancel-sign-sub-inv88.6%
metadata-eval88.6%
*-commutative88.6%
*-commutative88.6%
metadata-eval88.6%
Simplified88.6%
Taylor expanded in v around 0 83.5%
*-commutative83.5%
unpow283.5%
unpow283.5%
swap-sqr95.7%
unpow295.7%
*-commutative95.7%
Simplified95.7%
Taylor expanded in r around 0 61.8%
unpow261.8%
Simplified61.8%
div-inv61.8%
pow261.8%
pow-flip61.9%
metadata-eval61.9%
Applied egg-rr61.9%
metadata-eval61.9%
pow-flip61.8%
pow261.8%
associate-/r*61.8%
Applied egg-rr61.8%
if 1.7800000000000001e-99 < r Initial program 90.6%
sub-neg90.6%
+-commutative90.6%
associate--l+90.6%
associate-/l*91.8%
distribute-neg-frac91.8%
associate-/r/91.8%
fma-def91.8%
sub-neg91.8%
Simplified85.3%
Taylor expanded in v around 0 83.3%
associate--l+83.3%
associate-*r/83.3%
metadata-eval83.3%
unpow283.3%
*-commutative83.3%
unpow283.3%
unpow283.3%
Simplified83.3%
Final simplification68.6%
(FPCore (v w r) :precision binary64 (+ (- (+ (/ 2.0 (* r r)) 3.0) (* 0.375 (* (* r w) (* r w)))) -4.5))
double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - (0.375 * ((r * w) * (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 = (((2.0d0 / (r * r)) + 3.0d0) - (0.375d0 * ((r * w) * (r * w)))) + (-4.5d0)
end function
public static double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - (0.375 * ((r * w) * (r * w)))) + -4.5;
}
def code(v, w, r): return (((2.0 / (r * r)) + 3.0) - (0.375 * ((r * w) * (r * w)))) + -4.5
function code(v, w, r) return Float64(Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - Float64(0.375 * Float64(Float64(r * w) * Float64(r * w)))) + -4.5) end
function tmp = code(v, w, r) tmp = (((2.0 / (r * r)) + 3.0) - (0.375 * ((r * w) * (r * w)))) + -4.5; end
code[v_, w_, r_] := N[(N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{2}{r \cdot r} + 3\right) - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right) + -4.5
\end{array}
Initial program 87.8%
sub-neg87.8%
associate-/l*89.6%
cancel-sign-sub-inv89.6%
metadata-eval89.6%
*-commutative89.6%
*-commutative89.6%
metadata-eval89.6%
Simplified89.6%
Taylor expanded in v around 0 83.5%
*-commutative83.5%
unpow283.5%
unpow283.5%
swap-sqr94.7%
unpow294.7%
*-commutative94.7%
Simplified94.7%
unpow294.7%
Applied egg-rr94.7%
Final simplification94.7%
(FPCore (v w r) :precision binary64 (let* ((t_0 (/ 2.0 (* r r)))) (if (<= w 5.4e-103) (+ t_0 -1.5) (+ t_0 (* (* r r) (* w (* w -0.375)))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (w <= 5.4e-103) {
tmp = t_0 + -1.5;
} else {
tmp = t_0 + ((r * r) * (w * (w * -0.375)));
}
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 <= 5.4d-103) then
tmp = t_0 + (-1.5d0)
else
tmp = t_0 + ((r * r) * (w * (w * (-0.375d0))))
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 <= 5.4e-103) {
tmp = t_0 + -1.5;
} else {
tmp = t_0 + ((r * r) * (w * (w * -0.375)));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if w <= 5.4e-103: tmp = t_0 + -1.5 else: tmp = t_0 + ((r * r) * (w * (w * -0.375))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (w <= 5.4e-103) tmp = Float64(t_0 + -1.5); else tmp = Float64(t_0 + Float64(Float64(r * r) * Float64(w * Float64(w * -0.375)))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (w <= 5.4e-103) tmp = t_0 + -1.5; else tmp = t_0 + ((r * r) * (w * (w * -0.375))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, 5.4e-103], N[(t$95$0 + -1.5), $MachinePrecision], N[(t$95$0 + N[(N[(r * r), $MachinePrecision] * N[(w * N[(w * -0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \leq 5.4 \cdot 10^{-103}:\\
\;\;\;\;t_0 + -1.5\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(r \cdot r\right) \cdot \left(w \cdot \left(w \cdot -0.375\right)\right)\\
\end{array}
\end{array}
if w < 5.40000000000000019e-103Initial program 90.5%
sub-neg90.5%
+-commutative90.5%
associate--l+90.5%
associate-/l*91.1%
distribute-neg-frac91.1%
associate-/r/91.1%
fma-def91.1%
sub-neg91.1%
Simplified85.7%
Taylor expanded in r around 0 67.8%
sub-neg67.8%
associate-*r/67.8%
metadata-eval67.8%
unpow267.8%
metadata-eval67.8%
Simplified67.8%
if 5.40000000000000019e-103 < w Initial program 81.9%
sub-neg81.9%
+-commutative81.9%
associate--l+81.9%
associate-/l*86.5%
distribute-neg-frac86.5%
associate-/r/86.5%
fma-def86.6%
sub-neg86.6%
Simplified86.6%
Taylor expanded in v around 0 79.7%
associate--l+79.7%
associate-*r/79.7%
metadata-eval79.7%
unpow279.7%
*-commutative79.7%
fma-neg79.7%
*-commutative79.7%
unpow279.7%
unpow279.7%
swap-sqr92.0%
unpow292.0%
*-commutative92.0%
metadata-eval92.0%
Simplified92.0%
unpow292.0%
Applied egg-rr92.0%
Taylor expanded in w around inf 79.6%
unpow279.6%
unpow279.6%
associate-*r*79.6%
associate-*r*79.6%
*-commutative79.6%
Simplified79.6%
Final simplification71.6%
(FPCore (v w r) :precision binary64 (* 2.0 (/ (/ 1.0 r) r)))
double code(double v, double w, double r) {
return 2.0 * ((1.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 * ((1.0d0 / r) / r)
end function
public static double code(double v, double w, double r) {
return 2.0 * ((1.0 / r) / r);
}
def code(v, w, r): return 2.0 * ((1.0 / r) / r)
function code(v, w, r) return Float64(2.0 * Float64(Float64(1.0 / r) / r)) end
function tmp = code(v, w, r) tmp = 2.0 * ((1.0 / r) / r); end
code[v_, w_, r_] := N[(2.0 * N[(N[(1.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \frac{\frac{1}{r}}{r}
\end{array}
Initial program 87.8%
sub-neg87.8%
associate-/l*89.6%
cancel-sign-sub-inv89.6%
metadata-eval89.6%
*-commutative89.6%
*-commutative89.6%
metadata-eval89.6%
Simplified89.6%
Taylor expanded in v around 0 83.5%
*-commutative83.5%
unpow283.5%
unpow283.5%
swap-sqr94.7%
unpow294.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in r around 0 48.5%
unpow248.5%
Simplified48.5%
div-inv48.5%
pow248.5%
pow-flip48.6%
metadata-eval48.6%
Applied egg-rr48.6%
metadata-eval48.6%
pow-flip48.5%
pow248.5%
associate-/r*48.5%
Applied egg-rr48.5%
Final simplification48.5%
(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 87.8%
sub-neg87.8%
+-commutative87.8%
associate--l+87.8%
associate-/l*89.6%
distribute-neg-frac89.6%
associate-/r/89.6%
fma-def89.6%
sub-neg89.6%
Simplified86.0%
Taylor expanded in r around 0 61.5%
sub-neg61.5%
associate-*r/61.5%
metadata-eval61.5%
unpow261.5%
metadata-eval61.5%
Simplified61.5%
Final simplification61.5%
(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 87.8%
sub-neg87.8%
associate-/l*89.6%
cancel-sign-sub-inv89.6%
metadata-eval89.6%
*-commutative89.6%
*-commutative89.6%
metadata-eval89.6%
Simplified89.6%
Taylor expanded in v around 0 83.5%
*-commutative83.5%
unpow283.5%
unpow283.5%
swap-sqr94.7%
unpow294.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in r around 0 48.5%
unpow248.5%
Simplified48.5%
Final simplification48.5%
herbie shell --seed 2023252
(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))