
(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 (+ (* (pow (/ (- 1.0 v) (fma v 0.25 -0.375)) -1.0) (pow (* r w) 2.0)) (fma 2.0 (pow r -2.0) -1.5)))
double code(double v, double w, double r) {
return (pow(((1.0 - v) / fma(v, 0.25, -0.375)), -1.0) * pow((r * w), 2.0)) + fma(2.0, pow(r, -2.0), -1.5);
}
function code(v, w, r) return Float64(Float64((Float64(Float64(1.0 - v) / fma(v, 0.25, -0.375)) ^ -1.0) * (Float64(r * w) ^ 2.0)) + fma(2.0, (r ^ -2.0), -1.5)) end
code[v_, w_, r_] := N[(N[(N[Power[N[(N[(1.0 - v), $MachinePrecision] / N[(v * 0.25 + -0.375), $MachinePrecision]), $MachinePrecision], -1.0], $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}
\\
{\left(\frac{1 - v}{\mathsf{fma}\left(v, 0.25, -0.375\right)}\right)}^{-1} \cdot {\left(r \cdot w\right)}^{2} + \mathsf{fma}\left(2, {r}^{-2}, -1.5\right)
\end{array}
Initial program 84.9%
sub-neg84.9%
+-commutative84.9%
associate--l+84.9%
associate-/l*86.3%
distribute-neg-frac86.3%
associate-/r/86.3%
fma-def86.3%
sub-neg86.3%
Simplified78.3%
fma-udef78.3%
unswap-sqr99.8%
pow299.8%
div-inv99.8%
fma-def99.8%
pow299.8%
pow-flip99.9%
metadata-eval99.9%
Applied egg-rr99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (v w r) :precision binary64 (+ (fma 2.0 (pow r -2.0) -1.5) (* (pow (* r w) 2.0) (/ (fma v 0.25 -0.375) (- 1.0 v)))))
double code(double v, double w, double r) {
return fma(2.0, pow(r, -2.0), -1.5) + (pow((r * w), 2.0) * (fma(v, 0.25, -0.375) / (1.0 - v)));
}
function code(v, w, r) return Float64(fma(2.0, (r ^ -2.0), -1.5) + Float64((Float64(r * w) ^ 2.0) * Float64(fma(v, 0.25, -0.375) / Float64(1.0 - v)))) end
code[v_, w_, r_] := N[(N[(2.0 * N[Power[r, -2.0], $MachinePrecision] + -1.5), $MachinePrecision] + N[(N[Power[N[(r * w), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(v * 0.25 + -0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2, {r}^{-2}, -1.5\right) + {\left(r \cdot w\right)}^{2} \cdot \frac{\mathsf{fma}\left(v, 0.25, -0.375\right)}{1 - v}
\end{array}
Initial program 84.9%
sub-neg84.9%
+-commutative84.9%
associate--l+84.9%
associate-/l*86.3%
distribute-neg-frac86.3%
associate-/r/86.3%
fma-def86.3%
sub-neg86.3%
Simplified78.3%
fma-udef78.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 (+ (/ 2.0 (* r r)) (- -1.5 (* (pow (* r w) 2.0) (/ (+ 0.375 (* v -0.25)) (- 1.0 v))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (pow((r * w), 2.0) * ((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) ** 2.0d0) * ((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 - (Math.pow((r * w), 2.0) * ((0.375 + (v * -0.25)) / (1.0 - v))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (math.pow((r * w), 2.0) * ((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 * w) ^ 2.0) * 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) ^ 2.0) * ((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[Power[N[(r * w), $MachinePrecision], 2.0], $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 w\right)}^{2} \cdot \frac{0.375 + v \cdot -0.25}{1 - v}\right)
\end{array}
Initial program 84.9%
associate--l-84.9%
+-commutative84.9%
associate--l+84.9%
+-commutative84.9%
associate--r+84.9%
metadata-eval84.9%
associate-*l/86.3%
*-commutative86.3%
*-commutative86.3%
*-commutative86.3%
Simplified86.3%
Taylor expanded in r around 0 78.3%
*-commutative78.3%
unpow278.3%
unpow278.3%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 1.0 (* r w))))
(+
(-
(+ (/ 2.0 (* r r)) 3.0)
(/ (* 0.125 (+ 3.0 (* v -2.0))) (* (- 1.0 v) (* t_0 t_0))))
-4.5)))
double code(double v, double w, double r) {
double t_0 = 1.0 / (r * w);
return (((2.0 / (r * r)) + 3.0) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * (t_0 * t_0)))) + -4.5;
}
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 = 1.0d0 / (r * w)
code = (((2.0d0 / (r * r)) + 3.0d0) - ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) / ((1.0d0 - v) * (t_0 * t_0)))) + (-4.5d0)
end function
public static double code(double v, double w, double r) {
double t_0 = 1.0 / (r * w);
return (((2.0 / (r * r)) + 3.0) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * (t_0 * t_0)))) + -4.5;
}
def code(v, w, r): t_0 = 1.0 / (r * w) return (((2.0 / (r * r)) + 3.0) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * (t_0 * t_0)))) + -4.5
function code(v, w, r) t_0 = Float64(1.0 / Float64(r * w)) return Float64(Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) / Float64(Float64(1.0 - v) * Float64(t_0 * t_0)))) + -4.5) end
function tmp = code(v, w, r) t_0 = 1.0 / (r * w); tmp = (((2.0 / (r * r)) + 3.0) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * (t_0 * t_0)))) + -4.5; end
code[v_, w_, r_] := Block[{t$95$0 = N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - v), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{r \cdot w}\\
\left(\left(\frac{2}{r \cdot r} + 3\right) - \frac{0.125 \cdot \left(3 + v \cdot -2\right)}{\left(1 - v\right) \cdot \left(t_0 \cdot t_0\right)}\right) + -4.5
\end{array}
\end{array}
Initial program 84.9%
sub-neg84.9%
associate-/l*86.3%
cancel-sign-sub-inv86.3%
metadata-eval86.3%
*-commutative86.3%
*-commutative86.3%
metadata-eval86.3%
Simplified86.3%
div-inv86.3%
associate-*r*78.3%
unswap-sqr99.8%
pow299.8%
Applied egg-rr99.8%
add-sqr-sqrt99.7%
pow299.7%
sqrt-div99.8%
metadata-eval99.8%
sqrt-prod55.3%
add-sqr-sqrt77.9%
pow277.9%
sqrt-div77.9%
metadata-eval77.9%
sqrt-prod55.3%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 4e-91)
(+ t_0 (+ -1.5 (* -0.375 (* w (* w (* r r))))))
(+
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 <= 4e-91) {
tmp = t_0 + (-1.5 + (-0.375 * (w * (w * (r * r)))));
} 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 <= 4d-91) then
tmp = t_0 + ((-1.5d0) + ((-0.375d0) * (w * (w * (r * r)))))
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 <= 4e-91) {
tmp = t_0 + (-1.5 + (-0.375 * (w * (w * (r * r)))));
} 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 <= 4e-91: tmp = t_0 + (-1.5 + (-0.375 * (w * (w * (r * r))))) 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 <= 4e-91) tmp = Float64(t_0 + Float64(-1.5 + Float64(-0.375 * Float64(w * Float64(w * Float64(r * r)))))); 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 <= 4e-91) tmp = t_0 + (-1.5 + (-0.375 * (w * (w * (r * r))))); 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, 4e-91], N[(t$95$0 + N[(-1.5 + N[(-0.375 * N[(w * N[(w * N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(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 4 \cdot 10^{-91}:\\
\;\;\;\;t_0 + \left(-1.5 + -0.375 \cdot \left(w \cdot \left(w \cdot \left(r \cdot r\right)\right)\right)\right)\\
\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 < 4.00000000000000009e-91Initial program 82.2%
sub-neg82.2%
+-commutative82.2%
associate--l+82.2%
associate-/l*83.7%
distribute-neg-frac83.7%
associate-/r/83.7%
fma-def83.7%
sub-neg83.7%
Simplified77.6%
Taylor expanded in v around 0 76.3%
associate--l+76.3%
associate-*r/76.3%
metadata-eval76.3%
unpow276.3%
*-commutative76.3%
fma-neg76.3%
*-commutative76.3%
unpow276.3%
unpow276.3%
swap-sqr95.7%
unpow295.7%
*-commutative95.7%
metadata-eval95.7%
Simplified95.7%
fma-udef95.7%
*-commutative95.7%
Applied egg-rr95.7%
*-commutative95.7%
unpow295.7%
unswap-sqr76.3%
associate-*l*89.3%
Applied egg-rr89.3%
if 4.00000000000000009e-91 < r Initial program 91.8%
associate--l-91.8%
+-commutative91.8%
associate--l+91.8%
+-commutative91.8%
associate--r+91.8%
metadata-eval91.8%
associate-*l/93.1%
*-commutative93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in r around 0 93.1%
*-commutative93.1%
unpow293.1%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification92.2%
(FPCore (v w r) :precision binary64 (if (<= r 6e+115) (+ (/ 2.0 (* r r)) (+ -1.5 (* -0.375 (* w (* w (* r r)))))) (+ -1.5 (/ w (/ -2.6666666666666665 (* r (* r w)))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 6e+115) {
tmp = (2.0 / (r * r)) + (-1.5 + (-0.375 * (w * (w * (r * r)))));
} else {
tmp = -1.5 + (w / (-2.6666666666666665 / (r * (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) :: tmp
if (r <= 6d+115) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + ((-0.375d0) * (w * (w * (r * r)))))
else
tmp = (-1.5d0) + (w / ((-2.6666666666666665d0) / (r * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 6e+115) {
tmp = (2.0 / (r * r)) + (-1.5 + (-0.375 * (w * (w * (r * r)))));
} else {
tmp = -1.5 + (w / (-2.6666666666666665 / (r * (r * w))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 6e+115: tmp = (2.0 / (r * r)) + (-1.5 + (-0.375 * (w * (w * (r * r))))) else: tmp = -1.5 + (w / (-2.6666666666666665 / (r * (r * w)))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 6e+115) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(-0.375 * Float64(w * Float64(w * Float64(r * r)))))); else tmp = Float64(-1.5 + Float64(w / Float64(-2.6666666666666665 / Float64(r * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 6e+115) tmp = (2.0 / (r * r)) + (-1.5 + (-0.375 * (w * (w * (r * r))))); else tmp = -1.5 + (w / (-2.6666666666666665 / (r * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 6e+115], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(-0.375 * N[(w * N[(w * N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.5 + N[(w / N[(-2.6666666666666665 / N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 6 \cdot 10^{+115}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + -0.375 \cdot \left(w \cdot \left(w \cdot \left(r \cdot r\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \frac{w}{\frac{-2.6666666666666665}{r \cdot \left(r \cdot w\right)}}\\
\end{array}
\end{array}
if r < 6.0000000000000001e115Initial program 84.7%
sub-neg84.7%
+-commutative84.7%
associate--l+84.7%
associate-/l*86.0%
distribute-neg-frac86.0%
associate-/r/86.0%
fma-def86.0%
sub-neg86.0%
Simplified80.7%
Taylor expanded in v around 0 79.2%
associate--l+79.2%
associate-*r/79.2%
metadata-eval79.2%
unpow279.2%
*-commutative79.2%
fma-neg79.2%
*-commutative79.2%
unpow279.2%
unpow279.2%
swap-sqr95.9%
unpow295.9%
*-commutative95.9%
metadata-eval95.9%
Simplified95.9%
fma-udef95.9%
*-commutative95.9%
Applied egg-rr95.9%
*-commutative95.9%
unpow295.9%
unswap-sqr79.2%
associate-*l*90.4%
Applied egg-rr90.4%
if 6.0000000000000001e115 < r Initial program 85.8%
sub-neg85.8%
+-commutative85.8%
associate--l+85.8%
associate-/l*88.0%
distribute-neg-frac88.0%
associate-/r/88.1%
fma-def88.1%
sub-neg88.1%
Simplified65.6%
Taylor expanded in r around inf 63.2%
sub-neg63.2%
associate-/l*63.2%
unpow263.2%
unpow263.2%
*-commutative63.2%
fma-neg63.2%
metadata-eval63.2%
metadata-eval63.2%
Simplified63.2%
clear-num63.2%
inv-pow63.2%
associate-*l*63.2%
Applied egg-rr63.2%
unpow-163.2%
clear-num63.2%
associate-/l*64.1%
associate-/l/64.1%
associate-*r*64.1%
*-commutative64.1%
Applied egg-rr64.1%
Taylor expanded in v around 0 64.5%
*-commutative64.5%
unpow264.5%
associate-*r*82.2%
*-commutative82.2%
Simplified82.2%
Final simplification89.1%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 6e-38)
(+ t_0 -4.5)
(if (or (<= r 1.45e-24) (not (<= r 0.42)))
(+ -1.5 (/ w (/ -4.0 (* r (* r w)))))
(+ -1.5 t_0)))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 6e-38) {
tmp = t_0 + -4.5;
} else if ((r <= 1.45e-24) || !(r <= 0.42)) {
tmp = -1.5 + (w / (-4.0 / (r * (r * w))));
} else {
tmp = -1.5 + t_0;
}
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 <= 6d-38) then
tmp = t_0 + (-4.5d0)
else if ((r <= 1.45d-24) .or. (.not. (r <= 0.42d0))) then
tmp = (-1.5d0) + (w / ((-4.0d0) / (r * (r * w))))
else
tmp = (-1.5d0) + t_0
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 <= 6e-38) {
tmp = t_0 + -4.5;
} else if ((r <= 1.45e-24) || !(r <= 0.42)) {
tmp = -1.5 + (w / (-4.0 / (r * (r * w))));
} else {
tmp = -1.5 + t_0;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 6e-38: tmp = t_0 + -4.5 elif (r <= 1.45e-24) or not (r <= 0.42): tmp = -1.5 + (w / (-4.0 / (r * (r * w)))) else: tmp = -1.5 + t_0 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 6e-38) tmp = Float64(t_0 + -4.5); elseif ((r <= 1.45e-24) || !(r <= 0.42)) tmp = Float64(-1.5 + Float64(w / Float64(-4.0 / Float64(r * Float64(r * w))))); else tmp = Float64(-1.5 + t_0); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 6e-38) tmp = t_0 + -4.5; elseif ((r <= 1.45e-24) || ~((r <= 0.42))) tmp = -1.5 + (w / (-4.0 / (r * (r * w)))); else tmp = -1.5 + t_0; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 6e-38], N[(t$95$0 + -4.5), $MachinePrecision], If[Or[LessEqual[r, 1.45e-24], N[Not[LessEqual[r, 0.42]], $MachinePrecision]], N[(-1.5 + N[(w / N[(-4.0 / N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.5 + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 6 \cdot 10^{-38}:\\
\;\;\;\;t_0 + -4.5\\
\mathbf{elif}\;r \leq 1.45 \cdot 10^{-24} \lor \neg \left(r \leq 0.42\right):\\
\;\;\;\;-1.5 + \frac{w}{\frac{-4}{r \cdot \left(r \cdot w\right)}}\\
\mathbf{else}:\\
\;\;\;\;-1.5 + t_0\\
\end{array}
\end{array}
if r < 5.99999999999999977e-38Initial program 83.0%
sub-neg83.0%
associate-/l*84.4%
cancel-sign-sub-inv84.4%
metadata-eval84.4%
*-commutative84.4%
*-commutative84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in v around 0 70.0%
unpow270.0%
unpow270.0%
Simplified70.0%
Taylor expanded in r around 0 58.2%
unpow258.2%
Simplified58.2%
if 5.99999999999999977e-38 < r < 1.4499999999999999e-24 or 0.419999999999999984 < r Initial program 90.5%
sub-neg90.5%
+-commutative90.5%
associate--l+90.5%
associate-/l*92.0%
distribute-neg-frac92.0%
associate-/r/92.0%
fma-def92.0%
sub-neg92.0%
Simplified76.9%
Taylor expanded in r around inf 70.4%
sub-neg70.4%
associate-/l*70.4%
unpow270.4%
unpow270.4%
*-commutative70.4%
fma-neg70.4%
metadata-eval70.4%
metadata-eval70.4%
Simplified70.4%
clear-num70.5%
inv-pow70.5%
associate-*l*70.5%
Applied egg-rr70.5%
unpow-170.5%
clear-num70.4%
associate-/l*71.1%
associate-/l/71.1%
associate-*r*71.1%
*-commutative71.1%
Applied egg-rr71.1%
Taylor expanded in v around inf 65.4%
*-commutative65.4%
unpow265.4%
associate-*r*75.8%
*-commutative75.8%
Simplified75.8%
if 1.4499999999999999e-24 < r < 0.419999999999999984Initial program 99.2%
sub-neg99.2%
+-commutative99.2%
associate--l+99.2%
associate-/l*99.2%
distribute-neg-frac99.2%
associate-/r/99.2%
fma-def99.2%
sub-neg99.2%
Simplified99.2%
Taylor expanded in r around 0 99.2%
sub-neg99.2%
associate-*r/99.2%
metadata-eval99.2%
unpow299.2%
metadata-eval99.2%
Simplified99.2%
Final simplification62.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* r (* r w))) (t_1 (/ 2.0 (* r r))))
(if (<= r 2.9e-38)
(+ t_1 -4.5)
(if (<= r 1.45e-24)
(+ -1.5 (/ w (/ -4.0 t_0)))
(if (<= r 9.5e-6)
(+ -1.5 t_1)
(+ -1.5 (/ w (/ -2.6666666666666665 t_0))))))))
double code(double v, double w, double r) {
double t_0 = r * (r * w);
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 2.9e-38) {
tmp = t_1 + -4.5;
} else if (r <= 1.45e-24) {
tmp = -1.5 + (w / (-4.0 / t_0));
} else if (r <= 9.5e-6) {
tmp = -1.5 + t_1;
} else {
tmp = -1.5 + (w / (-2.6666666666666665 / t_0));
}
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 = r * (r * w)
t_1 = 2.0d0 / (r * r)
if (r <= 2.9d-38) then
tmp = t_1 + (-4.5d0)
else if (r <= 1.45d-24) then
tmp = (-1.5d0) + (w / ((-4.0d0) / t_0))
else if (r <= 9.5d-6) then
tmp = (-1.5d0) + t_1
else
tmp = (-1.5d0) + (w / ((-2.6666666666666665d0) / t_0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = r * (r * w);
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 2.9e-38) {
tmp = t_1 + -4.5;
} else if (r <= 1.45e-24) {
tmp = -1.5 + (w / (-4.0 / t_0));
} else if (r <= 9.5e-6) {
tmp = -1.5 + t_1;
} else {
tmp = -1.5 + (w / (-2.6666666666666665 / t_0));
}
return tmp;
}
def code(v, w, r): t_0 = r * (r * w) t_1 = 2.0 / (r * r) tmp = 0 if r <= 2.9e-38: tmp = t_1 + -4.5 elif r <= 1.45e-24: tmp = -1.5 + (w / (-4.0 / t_0)) elif r <= 9.5e-6: tmp = -1.5 + t_1 else: tmp = -1.5 + (w / (-2.6666666666666665 / t_0)) return tmp
function code(v, w, r) t_0 = Float64(r * Float64(r * w)) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 2.9e-38) tmp = Float64(t_1 + -4.5); elseif (r <= 1.45e-24) tmp = Float64(-1.5 + Float64(w / Float64(-4.0 / t_0))); elseif (r <= 9.5e-6) tmp = Float64(-1.5 + t_1); else tmp = Float64(-1.5 + Float64(w / Float64(-2.6666666666666665 / t_0))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r * (r * w); t_1 = 2.0 / (r * r); tmp = 0.0; if (r <= 2.9e-38) tmp = t_1 + -4.5; elseif (r <= 1.45e-24) tmp = -1.5 + (w / (-4.0 / t_0)); elseif (r <= 9.5e-6) tmp = -1.5 + t_1; else tmp = -1.5 + (w / (-2.6666666666666665 / t_0)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 2.9e-38], N[(t$95$1 + -4.5), $MachinePrecision], If[LessEqual[r, 1.45e-24], N[(-1.5 + N[(w / N[(-4.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 9.5e-6], N[(-1.5 + t$95$1), $MachinePrecision], N[(-1.5 + N[(w / N[(-2.6666666666666665 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := r \cdot \left(r \cdot w\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 2.9 \cdot 10^{-38}:\\
\;\;\;\;t_1 + -4.5\\
\mathbf{elif}\;r \leq 1.45 \cdot 10^{-24}:\\
\;\;\;\;-1.5 + \frac{w}{\frac{-4}{t_0}}\\
\mathbf{elif}\;r \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;-1.5 + t_1\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \frac{w}{\frac{-2.6666666666666665}{t_0}}\\
\end{array}
\end{array}
if r < 2.89999999999999994e-38Initial program 83.0%
sub-neg83.0%
associate-/l*84.4%
cancel-sign-sub-inv84.4%
metadata-eval84.4%
*-commutative84.4%
*-commutative84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in v around 0 70.0%
unpow270.0%
unpow270.0%
Simplified70.0%
Taylor expanded in r around 0 58.2%
unpow258.2%
Simplified58.2%
if 2.89999999999999994e-38 < r < 1.4499999999999999e-24Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate--l+100.0%
associate-/l*100.0%
distribute-neg-frac100.0%
associate-/r/100.0%
fma-def100.0%
sub-neg100.0%
Simplified99.6%
Taylor expanded in r around inf 75.0%
sub-neg75.0%
associate-/l*75.0%
unpow275.0%
unpow275.0%
*-commutative75.0%
fma-neg75.0%
metadata-eval75.0%
metadata-eval75.0%
Simplified75.0%
clear-num75.0%
inv-pow75.0%
associate-*l*75.0%
Applied egg-rr75.0%
unpow-175.0%
clear-num75.0%
associate-/l*75.0%
associate-/l/75.0%
associate-*r*75.0%
*-commutative75.0%
Applied egg-rr75.0%
Taylor expanded in v around inf 55.3%
*-commutative55.3%
unpow255.3%
associate-*r*55.3%
*-commutative55.3%
Simplified55.3%
if 1.4499999999999999e-24 < r < 9.5000000000000005e-6Initial program 99.2%
sub-neg99.2%
+-commutative99.2%
associate--l+99.2%
associate-/l*99.2%
distribute-neg-frac99.2%
associate-/r/99.2%
fma-def99.2%
sub-neg99.2%
Simplified99.2%
Taylor expanded in r around 0 99.2%
sub-neg99.2%
associate-*r/99.2%
metadata-eval99.2%
unpow299.2%
metadata-eval99.2%
Simplified99.2%
if 9.5000000000000005e-6 < r Initial program 89.8%
sub-neg89.8%
+-commutative89.8%
associate--l+89.8%
associate-/l*91.4%
distribute-neg-frac91.4%
associate-/r/91.5%
fma-def91.4%
sub-neg91.4%
Simplified75.3%
Taylor expanded in r around inf 70.1%
sub-neg70.1%
associate-/l*70.1%
unpow270.1%
unpow270.1%
*-commutative70.1%
fma-neg70.1%
metadata-eval70.1%
metadata-eval70.1%
Simplified70.1%
clear-num70.1%
inv-pow70.1%
associate-*l*70.2%
Applied egg-rr70.2%
unpow-170.2%
clear-num70.1%
associate-/l*70.9%
associate-/l/70.8%
associate-*r*70.8%
*-commutative70.8%
Applied egg-rr70.8%
Taylor expanded in v around 0 73.2%
*-commutative73.2%
unpow273.2%
associate-*r*85.8%
*-commutative85.8%
Simplified85.8%
Final simplification64.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 5.8e-38)
(+ t_0 -4.5)
(if (<= r 2.3e-24)
(+ -1.5 (/ (* w w) (/ -4.0 (* r r))))
(if (<= r 1.04e-5)
(+ -1.5 t_0)
(+ -1.5 (/ w (/ -2.6666666666666665 (* r (* r w))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 5.8e-38) {
tmp = t_0 + -4.5;
} else if (r <= 2.3e-24) {
tmp = -1.5 + ((w * w) / (-4.0 / (r * r)));
} else if (r <= 1.04e-5) {
tmp = -1.5 + t_0;
} else {
tmp = -1.5 + (w / (-2.6666666666666665 / (r * (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 <= 5.8d-38) then
tmp = t_0 + (-4.5d0)
else if (r <= 2.3d-24) then
tmp = (-1.5d0) + ((w * w) / ((-4.0d0) / (r * r)))
else if (r <= 1.04d-5) then
tmp = (-1.5d0) + t_0
else
tmp = (-1.5d0) + (w / ((-2.6666666666666665d0) / (r * (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 <= 5.8e-38) {
tmp = t_0 + -4.5;
} else if (r <= 2.3e-24) {
tmp = -1.5 + ((w * w) / (-4.0 / (r * r)));
} else if (r <= 1.04e-5) {
tmp = -1.5 + t_0;
} else {
tmp = -1.5 + (w / (-2.6666666666666665 / (r * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 5.8e-38: tmp = t_0 + -4.5 elif r <= 2.3e-24: tmp = -1.5 + ((w * w) / (-4.0 / (r * r))) elif r <= 1.04e-5: tmp = -1.5 + t_0 else: tmp = -1.5 + (w / (-2.6666666666666665 / (r * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 5.8e-38) tmp = Float64(t_0 + -4.5); elseif (r <= 2.3e-24) tmp = Float64(-1.5 + Float64(Float64(w * w) / Float64(-4.0 / Float64(r * r)))); elseif (r <= 1.04e-5) tmp = Float64(-1.5 + t_0); else tmp = Float64(-1.5 + Float64(w / Float64(-2.6666666666666665 / Float64(r * 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 <= 5.8e-38) tmp = t_0 + -4.5; elseif (r <= 2.3e-24) tmp = -1.5 + ((w * w) / (-4.0 / (r * r))); elseif (r <= 1.04e-5) tmp = -1.5 + t_0; else tmp = -1.5 + (w / (-2.6666666666666665 / (r * (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, 5.8e-38], N[(t$95$0 + -4.5), $MachinePrecision], If[LessEqual[r, 2.3e-24], N[(-1.5 + N[(N[(w * w), $MachinePrecision] / N[(-4.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 1.04e-5], N[(-1.5 + t$95$0), $MachinePrecision], N[(-1.5 + N[(w / N[(-2.6666666666666665 / N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 5.8 \cdot 10^{-38}:\\
\;\;\;\;t_0 + -4.5\\
\mathbf{elif}\;r \leq 2.3 \cdot 10^{-24}:\\
\;\;\;\;-1.5 + \frac{w \cdot w}{\frac{-4}{r \cdot r}}\\
\mathbf{elif}\;r \leq 1.04 \cdot 10^{-5}:\\
\;\;\;\;-1.5 + t_0\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \frac{w}{\frac{-2.6666666666666665}{r \cdot \left(r \cdot w\right)}}\\
\end{array}
\end{array}
if r < 5.79999999999999988e-38Initial program 83.0%
sub-neg83.0%
associate-/l*84.4%
cancel-sign-sub-inv84.4%
metadata-eval84.4%
*-commutative84.4%
*-commutative84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in v around 0 70.0%
unpow270.0%
unpow270.0%
Simplified70.0%
Taylor expanded in r around 0 58.2%
unpow258.2%
Simplified58.2%
if 5.79999999999999988e-38 < r < 2.3000000000000001e-24Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate--l+100.0%
associate-/l*100.0%
distribute-neg-frac100.0%
associate-/r/100.0%
fma-def100.0%
sub-neg100.0%
Simplified99.6%
Taylor expanded in r around inf 75.0%
sub-neg75.0%
associate-/l*75.0%
unpow275.0%
unpow275.0%
*-commutative75.0%
fma-neg75.0%
metadata-eval75.0%
metadata-eval75.0%
Simplified75.0%
Taylor expanded in v around inf 55.3%
unpow255.3%
Simplified55.3%
if 2.3000000000000001e-24 < r < 1.04000000000000004e-5Initial program 99.2%
sub-neg99.2%
+-commutative99.2%
associate--l+99.2%
associate-/l*99.2%
distribute-neg-frac99.2%
associate-/r/99.2%
fma-def99.2%
sub-neg99.2%
Simplified99.2%
Taylor expanded in r around 0 99.2%
sub-neg99.2%
associate-*r/99.2%
metadata-eval99.2%
unpow299.2%
metadata-eval99.2%
Simplified99.2%
if 1.04000000000000004e-5 < r Initial program 89.8%
sub-neg89.8%
+-commutative89.8%
associate--l+89.8%
associate-/l*91.4%
distribute-neg-frac91.4%
associate-/r/91.5%
fma-def91.4%
sub-neg91.4%
Simplified75.3%
Taylor expanded in r around inf 70.1%
sub-neg70.1%
associate-/l*70.1%
unpow270.1%
unpow270.1%
*-commutative70.1%
fma-neg70.1%
metadata-eval70.1%
metadata-eval70.1%
Simplified70.1%
clear-num70.1%
inv-pow70.1%
associate-*l*70.2%
Applied egg-rr70.2%
unpow-170.2%
clear-num70.1%
associate-/l*70.9%
associate-/l/70.8%
associate-*r*70.8%
*-commutative70.8%
Applied egg-rr70.8%
Taylor expanded in v around 0 73.2%
*-commutative73.2%
unpow273.2%
associate-*r*85.8%
*-commutative85.8%
Simplified85.8%
Final simplification64.5%
(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 84.9%
sub-neg84.9%
+-commutative84.9%
associate--l+84.9%
associate-/l*86.3%
distribute-neg-frac86.3%
associate-/r/86.3%
fma-def86.3%
sub-neg86.3%
Simplified78.3%
Taylor expanded in v around 0 76.8%
associate--l+76.8%
associate-*r/76.8%
metadata-eval76.8%
unpow276.8%
*-commutative76.8%
fma-neg76.8%
*-commutative76.8%
unpow276.8%
unpow276.8%
swap-sqr94.6%
unpow294.6%
*-commutative94.6%
metadata-eval94.6%
Simplified94.6%
fma-udef94.6%
*-commutative94.6%
Applied egg-rr94.6%
unpow294.6%
Applied egg-rr94.6%
Final simplification94.6%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) -4.5))
double code(double v, double w, double r) {
return (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 = (2.0d0 / (r * r)) + (-4.5d0)
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + -4.5;
}
def code(v, w, r): return (2.0 / (r * r)) + -4.5
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + -4.5) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + -4.5; end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -4.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + -4.5
\end{array}
Initial program 84.9%
sub-neg84.9%
associate-/l*86.3%
cancel-sign-sub-inv86.3%
metadata-eval86.3%
*-commutative86.3%
*-commutative86.3%
metadata-eval86.3%
Simplified86.3%
Taylor expanded in v around 0 68.3%
unpow268.3%
unpow268.3%
Simplified68.3%
Taylor expanded in r around 0 46.6%
unpow246.6%
Simplified46.6%
Final simplification46.6%
(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 84.9%
sub-neg84.9%
+-commutative84.9%
associate--l+84.9%
associate-/l*86.3%
distribute-neg-frac86.3%
associate-/r/86.3%
fma-def86.3%
sub-neg86.3%
Simplified78.3%
Taylor expanded in r around 0 52.2%
sub-neg52.2%
associate-*r/52.2%
metadata-eval52.2%
unpow252.2%
metadata-eval52.2%
Simplified52.2%
Final simplification52.2%
herbie shell --seed 2023240
(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))