
(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 15 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 86.6%
sub-neg86.6%
+-commutative86.6%
associate--l+86.6%
associate-/l*90.3%
distribute-neg-frac90.3%
associate-/r/90.3%
fma-def90.3%
sub-neg90.3%
Simplified82.4%
fma-udef82.4%
unswap-sqr99.7%
pow299.7%
div-inv99.7%
fma-def99.7%
pow299.7%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (- (+ 3.0 (/ 2.0 (* r r))) (/ (* 0.125 (+ 3.0 (* v -2.0))) (pow (/ (pow (* r w) 2.0) (- 1.0 v)) -1.0))) -4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / pow((pow((r * w), 2.0) / (1.0 - v)), -1.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
code = ((3.0d0 + (2.0d0 / (r * r))) - ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) / ((((r * w) ** 2.0d0) / (1.0d0 - v)) ** (-1.0d0)))) + (-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 + (v * -2.0))) / Math.pow((Math.pow((r * w), 2.0) / (1.0 - v)), -1.0))) + -4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / math.pow((math.pow((r * w), 2.0) / (1.0 - v)), -1.0))) + -4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) / (Float64((Float64(r * w) ^ 2.0) / Float64(1.0 - v)) ^ -1.0))) + -4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((((r * w) ^ 2.0) / (1.0 - v)) ^ -1.0))) + -4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(N[Power[N[(r * w), $MachinePrecision], 2.0], $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{0.125 \cdot \left(3 + v \cdot -2\right)}{{\left(\frac{{\left(r \cdot w\right)}^{2}}{1 - v}\right)}^{-1}}\right) + -4.5
\end{array}
Initial program 86.6%
sub-neg86.6%
associate-/l*90.3%
cancel-sign-sub-inv90.3%
metadata-eval90.3%
*-commutative90.3%
*-commutative90.3%
metadata-eval90.3%
Simplified90.3%
clear-num90.3%
inv-pow90.3%
associate-*r*82.4%
unswap-sqr99.8%
pow299.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ -4.5 (- (+ 3.0 (/ 2.0 (* r r))) (* (fma v -2.0 3.0) (* (/ 0.125 (- 1.0 v)) (pow (* r w) 2.0))))))
double code(double v, double w, double r) {
return -4.5 + ((3.0 + (2.0 / (r * r))) - (fma(v, -2.0, 3.0) * ((0.125 / (1.0 - v)) * pow((r * w), 2.0))));
}
function code(v, w, r) return Float64(-4.5 + Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(fma(v, -2.0, 3.0) * Float64(Float64(0.125 / Float64(1.0 - v)) * (Float64(r * w) ^ 2.0))))) end
code[v_, w_, r_] := N[(-4.5 + N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(v * -2.0 + 3.0), $MachinePrecision] * N[(N[(0.125 / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[Power[N[(r * w), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4.5 + \left(\left(3 + \frac{2}{r \cdot r}\right) - \mathsf{fma}\left(v, -2, 3\right) \cdot \left(\frac{0.125}{1 - v} \cdot {\left(r \cdot w\right)}^{2}\right)\right)
\end{array}
Initial program 86.6%
sub-neg86.6%
associate-/l*90.3%
cancel-sign-sub-inv90.3%
metadata-eval90.3%
*-commutative90.3%
*-commutative90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in r around 0 80.6%
associate-*r/80.6%
associate-/l*80.6%
+-commutative80.6%
fma-udef80.6%
*-commutative80.6%
unpow280.6%
unpow280.6%
swap-sqr95.0%
unpow295.0%
associate-/l/99.8%
associate-/r/99.7%
*-commutative99.7%
fma-udef99.7%
*-commutative99.7%
fma-def99.7%
unpow299.7%
swap-sqr82.4%
unpow282.4%
unpow282.4%
*-commutative82.4%
Simplified99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ -4.5 (- (+ 3.0 (/ 2.0 (* r r))) (/ (* 0.125 (+ 3.0 (* v -2.0))) (/ (- 1.0 v) (pow (* r w) 2.0))))))
double code(double v, double w, double r) {
return -4.5 + ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) / pow((r * w), 2.0))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (-4.5d0) + ((3.0d0 + (2.0d0 / (r * r))) - ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) / ((1.0d0 - v) / ((r * w) ** 2.0d0))))
end function
public static double code(double v, double w, double r) {
return -4.5 + ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) / Math.pow((r * w), 2.0))));
}
def code(v, w, r): return -4.5 + ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) / math.pow((r * w), 2.0))))
function code(v, w, r) return Float64(-4.5 + Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) / Float64(Float64(1.0 - v) / (Float64(r * w) ^ 2.0))))) end
function tmp = code(v, w, r) tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) / ((r * w) ^ 2.0)))); end
code[v_, w_, r_] := N[(-4.5 + N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - v), $MachinePrecision] / N[Power[N[(r * w), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4.5 + \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{0.125 \cdot \left(3 + v \cdot -2\right)}{\frac{1 - v}{{\left(r \cdot w\right)}^{2}}}\right)
\end{array}
Initial program 86.6%
sub-neg86.6%
associate-/l*90.3%
cancel-sign-sub-inv90.3%
metadata-eval90.3%
*-commutative90.3%
*-commutative90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in r around 0 82.4%
*-commutative82.4%
unpow282.4%
unpow282.4%
swap-sqr99.7%
unpow299.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<=
(-
(+ 3.0 t_0)
(/ (* (* 0.125 (- 3.0 (* v 2.0))) (* r (* r (* w w)))) (- 1.0 v)))
3.0)
(+
t_0
(- -1.5 (* (* r (* w (* r w))) (/ (+ 0.375 (* v -0.25)) (- 1.0 v)))))
(+ -1.5 t_0))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (((3.0 + t_0) - (((0.125 * (3.0 - (v * 2.0))) * (r * (r * (w * w)))) / (1.0 - v))) <= 3.0) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
} 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 (((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (v * 2.0d0))) * (r * (r * (w * w)))) / (1.0d0 - v))) <= 3.0d0) then
tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * ((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v))))
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 (((3.0 + t_0) - (((0.125 * (3.0 - (v * 2.0))) * (r * (r * (w * w)))) / (1.0 - v))) <= 3.0) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
} else {
tmp = -1.5 + t_0;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if ((3.0 + t_0) - (((0.125 * (3.0 - (v * 2.0))) * (r * (r * (w * w)))) / (1.0 - v))) <= 3.0: tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))) 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 (Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(v * 2.0))) * Float64(r * Float64(r * Float64(w * w)))) / Float64(1.0 - v))) <= 3.0) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v))))); 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 (((3.0 + t_0) - (((0.125 * (3.0 - (v * 2.0))) * (r * (r * (w * w)))) / (1.0 - v))) <= 3.0) tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))); 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[N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(v * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], N[(t$95$0 + 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], N[(-1.5 + t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;\left(3 + t_0\right) - \frac{\left(0.125 \cdot \left(3 - v \cdot 2\right)\right) \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)}{1 - v} \leq 3:\\
\;\;\;\;t_0 + \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)\\
\mathbf{else}:\\
\;\;\;\;-1.5 + t_0\\
\end{array}
\end{array}
if (-.f64 (+.f64 3 (/.f64 2 (*.f64 r r))) (/.f64 (*.f64 (*.f64 1/8 (-.f64 3 (*.f64 2 v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 1 v))) < 3Initial program 85.7%
associate--l-85.7%
+-commutative85.7%
associate--l+85.7%
+-commutative85.7%
associate--r+85.7%
metadata-eval85.7%
associate-*l/92.3%
*-commutative92.3%
*-commutative92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in r around 0 92.3%
unpow292.3%
associate-*l*97.7%
Simplified97.7%
if 3 < (-.f64 (+.f64 3 (/.f64 2 (*.f64 r r))) (/.f64 (*.f64 (*.f64 1/8 (-.f64 3 (*.f64 2 v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 1 v))) Initial program 87.8%
sub-neg87.8%
+-commutative87.8%
associate--l+87.8%
associate-/l*87.8%
distribute-neg-frac87.8%
associate-/r/87.8%
fma-def87.8%
sub-neg87.8%
Simplified87.8%
Taylor expanded in r around 0 99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
unpow299.9%
metadata-eval99.9%
Simplified99.9%
Final simplification98.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 1.0 (* r w))))
(+
-4.5
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* 0.125 (+ 3.0 (* v -2.0))) (* (- 1.0 v) (* t_0 t_0)))))))
double code(double v, double w, double r) {
double t_0 = 1.0 / (r * w);
return -4.5 + ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * (t_0 * t_0))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
t_0 = 1.0d0 / (r * w)
code = (-4.5d0) + ((3.0d0 + (2.0d0 / (r * r))) - ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) / ((1.0d0 - v) * (t_0 * t_0))))
end function
public static double code(double v, double w, double r) {
double t_0 = 1.0 / (r * w);
return -4.5 + ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * (t_0 * t_0))));
}
def code(v, w, r): t_0 = 1.0 / (r * w) return -4.5 + ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * (t_0 * t_0))))
function code(v, w, r) t_0 = Float64(1.0 / Float64(r * w)) return Float64(-4.5 + Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) / Float64(Float64(1.0 - v) * Float64(t_0 * t_0))))) end
function tmp = code(v, w, r) t_0 = 1.0 / (r * w); tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * (t_0 * t_0)))); end
code[v_, w_, r_] := Block[{t$95$0 = N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]}, N[(-4.5 + N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $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]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{r \cdot w}\\
-4.5 + \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{0.125 \cdot \left(3 + v \cdot -2\right)}{\left(1 - v\right) \cdot \left(t_0 \cdot t_0\right)}\right)
\end{array}
\end{array}
Initial program 86.6%
sub-neg86.6%
associate-/l*90.3%
cancel-sign-sub-inv90.3%
metadata-eval90.3%
*-commutative90.3%
*-commutative90.3%
metadata-eval90.3%
Simplified90.3%
div-inv90.3%
associate-*r*82.4%
unswap-sqr99.7%
pow299.7%
Applied egg-rr99.7%
metadata-eval99.7%
unpow299.7%
frac-times99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= r -2.02e-48) (not (<= r 1.4e-121)))
(+
t_0
(- -1.5 (* (/ (+ 0.375 (* v -0.25)) (- 1.0 v)) (* r (* r (* w w))))))
(+ t_0 -4.5))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((r <= -2.02e-48) || !(r <= 1.4e-121)) {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
} else {
tmp = t_0 + -4.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 <= (-2.02d-48)) .or. (.not. (r <= 1.4d-121))) then
tmp = t_0 + ((-1.5d0) - (((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)) * (r * (r * (w * w)))))
else
tmp = t_0 + (-4.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 <= -2.02e-48) || !(r <= 1.4e-121)) {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
} else {
tmp = t_0 + -4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (r <= -2.02e-48) or not (r <= 1.4e-121): tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))) else: tmp = t_0 + -4.5 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((r <= -2.02e-48) || !(r <= 1.4e-121)) 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)))))); else tmp = Float64(t_0 + -4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((r <= -2.02e-48) || ~((r <= 1.4e-121))) tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))); else tmp = t_0 + -4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[r, -2.02e-48], N[Not[LessEqual[r, 1.4e-121]], $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], N[(t$95$0 + -4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq -2.02 \cdot 10^{-48} \lor \neg \left(r \leq 1.4 \cdot 10^{-121}\right):\\
\;\;\;\;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)\\
\mathbf{else}:\\
\;\;\;\;t_0 + -4.5\\
\end{array}
\end{array}
if r < -2.0199999999999999e-48 or 1.4000000000000001e-121 < r Initial program 90.0%
associate--l-90.0%
+-commutative90.0%
associate--l+90.0%
+-commutative90.0%
associate--r+90.0%
metadata-eval90.0%
associate-*l/95.7%
*-commutative95.7%
*-commutative95.7%
*-commutative95.7%
Simplified95.7%
if -2.0199999999999999e-48 < r < 1.4000000000000001e-121Initial program 81.0%
sub-neg81.0%
associate-/l*81.0%
cancel-sign-sub-inv81.0%
metadata-eval81.0%
*-commutative81.0%
*-commutative81.0%
metadata-eval81.0%
Simplified81.0%
Taylor expanded in v around 0 81.0%
unpow281.0%
unpow281.0%
Simplified81.0%
add-sqr-sqrt81.0%
unswap-sqr81.0%
unpow281.0%
sqrt-div81.0%
metadata-eval81.0%
unpow281.0%
sqrt-prod58.9%
add-sqr-sqrt81.1%
*-commutative81.1%
unswap-sqr97.8%
unpow297.8%
sqrt-div97.8%
metadata-eval97.8%
unpow297.8%
sqrt-prod65.2%
add-sqr-sqrt97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in r around 0 99.9%
unpow299.9%
Simplified99.9%
Final simplification97.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= r -2.02e-48) (not (<= r 1.8e-120)))
(+ -4.5 (- (+ 3.0 t_0) (* r (* (* r (* w w)) 0.375))))
(+ t_0 -4.5))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((r <= -2.02e-48) || !(r <= 1.8e-120)) {
tmp = -4.5 + ((3.0 + t_0) - (r * ((r * (w * w)) * 0.375)));
} else {
tmp = t_0 + -4.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 <= (-2.02d-48)) .or. (.not. (r <= 1.8d-120))) then
tmp = (-4.5d0) + ((3.0d0 + t_0) - (r * ((r * (w * w)) * 0.375d0)))
else
tmp = t_0 + (-4.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 <= -2.02e-48) || !(r <= 1.8e-120)) {
tmp = -4.5 + ((3.0 + t_0) - (r * ((r * (w * w)) * 0.375)));
} else {
tmp = t_0 + -4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (r <= -2.02e-48) or not (r <= 1.8e-120): tmp = -4.5 + ((3.0 + t_0) - (r * ((r * (w * w)) * 0.375))) else: tmp = t_0 + -4.5 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((r <= -2.02e-48) || !(r <= 1.8e-120)) tmp = Float64(-4.5 + Float64(Float64(3.0 + t_0) - Float64(r * Float64(Float64(r * Float64(w * w)) * 0.375)))); else tmp = Float64(t_0 + -4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((r <= -2.02e-48) || ~((r <= 1.8e-120))) tmp = -4.5 + ((3.0 + t_0) - (r * ((r * (w * w)) * 0.375))); else tmp = t_0 + -4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[r, -2.02e-48], N[Not[LessEqual[r, 1.8e-120]], $MachinePrecision]], N[(-4.5 + N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(r * N[(N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + -4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq -2.02 \cdot 10^{-48} \lor \neg \left(r \leq 1.8 \cdot 10^{-120}\right):\\
\;\;\;\;-4.5 + \left(\left(3 + t_0\right) - r \cdot \left(\left(r \cdot \left(w \cdot w\right)\right) \cdot 0.375\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + -4.5\\
\end{array}
\end{array}
if r < -2.0199999999999999e-48 or 1.8000000000000001e-120 < r Initial program 90.0%
sub-neg90.0%
associate-/l*95.7%
cancel-sign-sub-inv95.7%
metadata-eval95.7%
*-commutative95.7%
*-commutative95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in v around 0 65.4%
unpow265.4%
unpow265.4%
Simplified65.4%
unswap-sqr73.9%
unpow273.9%
associate-/r/73.9%
/-rgt-identity73.9%
unpow273.9%
unswap-sqr65.4%
associate-*r*73.9%
associate-*r*73.4%
distribute-lft-in73.4%
metadata-eval73.4%
associate-*r*73.4%
metadata-eval73.4%
Applied egg-rr73.4%
Taylor expanded in v around 0 87.3%
unpow287.3%
Simplified87.3%
if -2.0199999999999999e-48 < r < 1.8000000000000001e-120Initial program 81.0%
sub-neg81.0%
associate-/l*81.0%
cancel-sign-sub-inv81.0%
metadata-eval81.0%
*-commutative81.0%
*-commutative81.0%
metadata-eval81.0%
Simplified81.0%
Taylor expanded in v around 0 81.0%
unpow281.0%
unpow281.0%
Simplified81.0%
add-sqr-sqrt81.0%
unswap-sqr81.0%
unpow281.0%
sqrt-div81.0%
metadata-eval81.0%
unpow281.0%
sqrt-prod58.9%
add-sqr-sqrt81.1%
*-commutative81.1%
unswap-sqr97.8%
unpow297.8%
sqrt-div97.8%
metadata-eval97.8%
unpow297.8%
sqrt-prod65.2%
add-sqr-sqrt97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in r around 0 99.9%
unpow299.9%
Simplified99.9%
Final simplification92.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (+ 3.0 t_0)))
(if (<= r -2.02e-48)
(+ -4.5 (- t_1 (* r (* (* r (* w w)) 0.375))))
(if (<= r 7e-118)
(+ t_0 -4.5)
(+ -4.5 (- t_1 (* r (* r (* w (* w 0.375))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = 3.0 + t_0;
double tmp;
if (r <= -2.02e-48) {
tmp = -4.5 + (t_1 - (r * ((r * (w * w)) * 0.375)));
} else if (r <= 7e-118) {
tmp = t_0 + -4.5;
} else {
tmp = -4.5 + (t_1 - (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) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = 3.0d0 + t_0
if (r <= (-2.02d-48)) then
tmp = (-4.5d0) + (t_1 - (r * ((r * (w * w)) * 0.375d0)))
else if (r <= 7d-118) then
tmp = t_0 + (-4.5d0)
else
tmp = (-4.5d0) + (t_1 - (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 t_1 = 3.0 + t_0;
double tmp;
if (r <= -2.02e-48) {
tmp = -4.5 + (t_1 - (r * ((r * (w * w)) * 0.375)));
} else if (r <= 7e-118) {
tmp = t_0 + -4.5;
} else {
tmp = -4.5 + (t_1 - (r * (r * (w * (w * 0.375)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = 3.0 + t_0 tmp = 0 if r <= -2.02e-48: tmp = -4.5 + (t_1 - (r * ((r * (w * w)) * 0.375))) elif r <= 7e-118: tmp = t_0 + -4.5 else: tmp = -4.5 + (t_1 - (r * (r * (w * (w * 0.375))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(3.0 + t_0) tmp = 0.0 if (r <= -2.02e-48) tmp = Float64(-4.5 + Float64(t_1 - Float64(r * Float64(Float64(r * Float64(w * w)) * 0.375)))); elseif (r <= 7e-118) tmp = Float64(t_0 + -4.5); else tmp = Float64(-4.5 + Float64(t_1 - Float64(r * Float64(r * Float64(w * Float64(w * 0.375)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = 3.0 + t_0; tmp = 0.0; if (r <= -2.02e-48) tmp = -4.5 + (t_1 - (r * ((r * (w * w)) * 0.375))); elseif (r <= 7e-118) tmp = t_0 + -4.5; else tmp = -4.5 + (t_1 - (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]}, Block[{t$95$1 = N[(3.0 + t$95$0), $MachinePrecision]}, If[LessEqual[r, -2.02e-48], N[(-4.5 + N[(t$95$1 - N[(r * N[(N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 7e-118], N[(t$95$0 + -4.5), $MachinePrecision], N[(-4.5 + N[(t$95$1 - N[(r * N[(r * N[(w * N[(w * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := 3 + t_0\\
\mathbf{if}\;r \leq -2.02 \cdot 10^{-48}:\\
\;\;\;\;-4.5 + \left(t_1 - r \cdot \left(\left(r \cdot \left(w \cdot w\right)\right) \cdot 0.375\right)\right)\\
\mathbf{elif}\;r \leq 7 \cdot 10^{-118}:\\
\;\;\;\;t_0 + -4.5\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(t_1 - r \cdot \left(r \cdot \left(w \cdot \left(w \cdot 0.375\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < -2.0199999999999999e-48Initial program 87.0%
sub-neg87.0%
associate-/l*97.1%
cancel-sign-sub-inv97.1%
metadata-eval97.1%
*-commutative97.1%
*-commutative97.1%
metadata-eval97.1%
Simplified97.1%
Taylor expanded in v around 0 56.3%
unpow256.3%
unpow256.3%
Simplified56.3%
unswap-sqr68.0%
unpow268.0%
associate-/r/68.0%
/-rgt-identity68.0%
unpow268.0%
unswap-sqr56.3%
associate-*r*68.1%
associate-*r*68.1%
distribute-lft-in68.1%
metadata-eval68.1%
associate-*r*68.1%
metadata-eval68.1%
Applied egg-rr68.1%
Taylor expanded in v around 0 85.3%
unpow285.3%
Simplified85.3%
if -2.0199999999999999e-48 < r < 7e-118Initial program 81.0%
sub-neg81.0%
associate-/l*81.0%
cancel-sign-sub-inv81.0%
metadata-eval81.0%
*-commutative81.0%
*-commutative81.0%
metadata-eval81.0%
Simplified81.0%
Taylor expanded in v around 0 81.0%
unpow281.0%
unpow281.0%
Simplified81.0%
add-sqr-sqrt81.0%
unswap-sqr81.0%
unpow281.0%
sqrt-div81.0%
metadata-eval81.0%
unpow281.0%
sqrt-prod58.9%
add-sqr-sqrt81.1%
*-commutative81.1%
unswap-sqr97.8%
unpow297.8%
sqrt-div97.8%
metadata-eval97.8%
unpow297.8%
sqrt-prod65.2%
add-sqr-sqrt97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in r around 0 99.9%
unpow299.9%
Simplified99.9%
if 7e-118 < r Initial program 92.5%
sub-neg92.5%
associate-/l*94.6%
cancel-sign-sub-inv94.6%
metadata-eval94.6%
*-commutative94.6%
*-commutative94.6%
metadata-eval94.6%
Simplified94.6%
Taylor expanded in v around 0 73.0%
unpow273.0%
unpow273.0%
Simplified73.0%
unswap-sqr78.8%
unpow278.8%
associate-/r/78.8%
/-rgt-identity78.8%
unpow278.8%
unswap-sqr73.0%
associate-*r*78.8%
associate-*r*77.7%
distribute-lft-in77.7%
metadata-eval77.7%
associate-*r*77.7%
metadata-eval77.7%
Applied egg-rr77.7%
Taylor expanded in v around 0 89.0%
associate-*r*89.0%
*-commutative89.0%
unpow289.0%
associate-*r*89.0%
Simplified89.0%
Final simplification92.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= r -2.02e-48) (not (<= r 1e-119)))
(+ t_0 (- (* -0.375 (* (* r r) (* w w))) 1.5))
(+ t_0 -4.5))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((r <= -2.02e-48) || !(r <= 1e-119)) {
tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
} else {
tmp = t_0 + -4.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 <= (-2.02d-48)) .or. (.not. (r <= 1d-119))) then
tmp = t_0 + (((-0.375d0) * ((r * r) * (w * w))) - 1.5d0)
else
tmp = t_0 + (-4.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 <= -2.02e-48) || !(r <= 1e-119)) {
tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
} else {
tmp = t_0 + -4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (r <= -2.02e-48) or not (r <= 1e-119): tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5) else: tmp = t_0 + -4.5 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((r <= -2.02e-48) || !(r <= 1e-119)) tmp = Float64(t_0 + Float64(Float64(-0.375 * Float64(Float64(r * r) * Float64(w * w))) - 1.5)); else tmp = Float64(t_0 + -4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((r <= -2.02e-48) || ~((r <= 1e-119))) tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5); else tmp = t_0 + -4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[r, -2.02e-48], N[Not[LessEqual[r, 1e-119]], $MachinePrecision]], N[(t$95$0 + N[(N[(-0.375 * N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + -4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq -2.02 \cdot 10^{-48} \lor \neg \left(r \leq 10^{-119}\right):\\
\;\;\;\;t_0 + \left(-0.375 \cdot \left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) - 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + -4.5\\
\end{array}
\end{array}
if r < -2.0199999999999999e-48 or 1.00000000000000001e-119 < r Initial program 90.0%
sub-neg90.0%
+-commutative90.0%
associate--l+90.0%
associate-/l*95.7%
distribute-neg-frac95.7%
associate-/r/95.7%
fma-def95.8%
sub-neg95.8%
Simplified83.2%
Taylor expanded in v around 0 78.2%
associate--l+78.2%
associate-*r/78.2%
metadata-eval78.2%
unpow278.2%
*-commutative78.2%
unpow278.2%
unpow278.2%
Simplified78.2%
if -2.0199999999999999e-48 < r < 1.00000000000000001e-119Initial program 81.0%
sub-neg81.0%
associate-/l*81.0%
cancel-sign-sub-inv81.0%
metadata-eval81.0%
*-commutative81.0%
*-commutative81.0%
metadata-eval81.0%
Simplified81.0%
Taylor expanded in v around 0 81.0%
unpow281.0%
unpow281.0%
Simplified81.0%
add-sqr-sqrt81.0%
unswap-sqr81.0%
unpow281.0%
sqrt-div81.0%
metadata-eval81.0%
unpow281.0%
sqrt-prod58.9%
add-sqr-sqrt81.1%
*-commutative81.1%
unswap-sqr97.8%
unpow297.8%
sqrt-div97.8%
metadata-eval97.8%
unpow297.8%
sqrt-prod65.2%
add-sqr-sqrt97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in r around 0 99.9%
unpow299.9%
Simplified99.9%
Final simplification86.2%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (* (* r r) (* w w))))
(if (<= r -2.02e-48)
(+ t_0 (- (* -0.25 t_1) 1.5))
(if (<= r 1e-120) (+ t_0 -4.5) (+ t_0 (- (* -0.375 t_1) 1.5))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (r * r) * (w * w);
double tmp;
if (r <= -2.02e-48) {
tmp = t_0 + ((-0.25 * t_1) - 1.5);
} else if (r <= 1e-120) {
tmp = t_0 + -4.5;
} else {
tmp = t_0 + ((-0.375 * t_1) - 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) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = (r * r) * (w * w)
if (r <= (-2.02d-48)) then
tmp = t_0 + (((-0.25d0) * t_1) - 1.5d0)
else if (r <= 1d-120) then
tmp = t_0 + (-4.5d0)
else
tmp = t_0 + (((-0.375d0) * t_1) - 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 t_1 = (r * r) * (w * w);
double tmp;
if (r <= -2.02e-48) {
tmp = t_0 + ((-0.25 * t_1) - 1.5);
} else if (r <= 1e-120) {
tmp = t_0 + -4.5;
} else {
tmp = t_0 + ((-0.375 * t_1) - 1.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = (r * r) * (w * w) tmp = 0 if r <= -2.02e-48: tmp = t_0 + ((-0.25 * t_1) - 1.5) elif r <= 1e-120: tmp = t_0 + -4.5 else: tmp = t_0 + ((-0.375 * t_1) - 1.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(Float64(r * r) * Float64(w * w)) tmp = 0.0 if (r <= -2.02e-48) tmp = Float64(t_0 + Float64(Float64(-0.25 * t_1) - 1.5)); elseif (r <= 1e-120) tmp = Float64(t_0 + -4.5); else tmp = Float64(t_0 + Float64(Float64(-0.375 * t_1) - 1.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = (r * r) * (w * w); tmp = 0.0; if (r <= -2.02e-48) tmp = t_0 + ((-0.25 * t_1) - 1.5); elseif (r <= 1e-120) tmp = t_0 + -4.5; else tmp = t_0 + ((-0.375 * t_1) - 1.5); 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 * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, -2.02e-48], N[(t$95$0 + N[(N[(-0.25 * t$95$1), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 1e-120], N[(t$95$0 + -4.5), $MachinePrecision], N[(t$95$0 + N[(N[(-0.375 * t$95$1), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(r \cdot r\right) \cdot \left(w \cdot w\right)\\
\mathbf{if}\;r \leq -2.02 \cdot 10^{-48}:\\
\;\;\;\;t_0 + \left(-0.25 \cdot t_1 - 1.5\right)\\
\mathbf{elif}\;r \leq 10^{-120}:\\
\;\;\;\;t_0 + -4.5\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-0.375 \cdot t_1 - 1.5\right)\\
\end{array}
\end{array}
if r < -2.0199999999999999e-48Initial program 87.0%
sub-neg87.0%
+-commutative87.0%
associate--l+87.0%
associate-/l*97.1%
distribute-neg-frac97.1%
associate-/r/97.1%
fma-def97.2%
sub-neg97.2%
Simplified79.0%
Taylor expanded in v around inf 72.6%
associate--l+72.6%
associate-*r/72.6%
metadata-eval72.6%
unpow272.6%
*-commutative72.6%
unpow272.6%
unpow272.6%
Simplified72.6%
if -2.0199999999999999e-48 < r < 9.99999999999999979e-121Initial program 81.0%
sub-neg81.0%
associate-/l*81.0%
cancel-sign-sub-inv81.0%
metadata-eval81.0%
*-commutative81.0%
*-commutative81.0%
metadata-eval81.0%
Simplified81.0%
Taylor expanded in v around 0 81.0%
unpow281.0%
unpow281.0%
Simplified81.0%
add-sqr-sqrt81.0%
unswap-sqr81.0%
unpow281.0%
sqrt-div81.0%
metadata-eval81.0%
unpow281.0%
sqrt-prod58.9%
add-sqr-sqrt81.1%
*-commutative81.1%
unswap-sqr97.8%
unpow297.8%
sqrt-div97.8%
metadata-eval97.8%
unpow297.8%
sqrt-prod65.2%
add-sqr-sqrt97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in r around 0 99.9%
unpow299.9%
Simplified99.9%
if 9.99999999999999979e-121 < r Initial program 92.5%
sub-neg92.5%
+-commutative92.5%
associate--l+92.5%
associate-/l*94.6%
distribute-neg-frac94.6%
associate-/r/94.6%
fma-def94.6%
sub-neg94.6%
Simplified86.6%
Taylor expanded in v around 0 82.9%
associate--l+82.9%
associate-*r/82.9%
metadata-eval82.9%
unpow282.9%
*-commutative82.9%
unpow282.9%
unpow282.9%
Simplified82.9%
Final simplification86.3%
(FPCore (v w r) :precision binary64 (if (or (<= r -5.3) (not (<= r 5.6))) (+ -1.5 (* -0.375 (* (* r r) (* w w)))) (+ -1.5 (/ 2.0 (* r r)))))
double code(double v, double w, double r) {
double tmp;
if ((r <= -5.3) || !(r <= 5.6)) {
tmp = -1.5 + (-0.375 * ((r * r) * (w * w)));
} else {
tmp = -1.5 + (2.0 / (r * r));
}
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 <= (-5.3d0)) .or. (.not. (r <= 5.6d0))) then
tmp = (-1.5d0) + ((-0.375d0) * ((r * r) * (w * w)))
else
tmp = (-1.5d0) + (2.0d0 / (r * r))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if ((r <= -5.3) || !(r <= 5.6)) {
tmp = -1.5 + (-0.375 * ((r * r) * (w * w)));
} else {
tmp = -1.5 + (2.0 / (r * r));
}
return tmp;
}
def code(v, w, r): tmp = 0 if (r <= -5.3) or not (r <= 5.6): tmp = -1.5 + (-0.375 * ((r * r) * (w * w))) else: tmp = -1.5 + (2.0 / (r * r)) return tmp
function code(v, w, r) tmp = 0.0 if ((r <= -5.3) || !(r <= 5.6)) tmp = Float64(-1.5 + Float64(-0.375 * Float64(Float64(r * r) * Float64(w * w)))); else tmp = Float64(-1.5 + Float64(2.0 / Float64(r * r))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((r <= -5.3) || ~((r <= 5.6))) tmp = -1.5 + (-0.375 * ((r * r) * (w * w))); else tmp = -1.5 + (2.0 / (r * r)); end tmp_2 = tmp; end
code[v_, w_, r_] := If[Or[LessEqual[r, -5.3], N[Not[LessEqual[r, 5.6]], $MachinePrecision]], N[(-1.5 + N[(-0.375 * N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.5 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq -5.3 \lor \neg \left(r \leq 5.6\right):\\
\;\;\;\;-1.5 + -0.375 \cdot \left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \frac{2}{r \cdot r}\\
\end{array}
\end{array}
if r < -5.29999999999999982 or 5.5999999999999996 < r Initial program 90.2%
sub-neg90.2%
+-commutative90.2%
associate--l+90.2%
associate-/l*97.6%
distribute-neg-frac97.6%
associate-/r/97.6%
fma-def97.6%
sub-neg97.6%
Simplified81.4%
Taylor expanded in r around inf 69.4%
sub-neg69.4%
associate-*r*77.2%
associate-/l*80.9%
*-commutative80.9%
unpow280.9%
unpow280.9%
swap-sqr99.2%
unpow299.2%
*-commutative99.2%
*-commutative99.2%
fma-neg99.2%
metadata-eval99.2%
metadata-eval99.2%
Simplified99.2%
unpow299.2%
unswap-sqr80.9%
div-inv80.9%
times-frac70.3%
Applied egg-rr70.3%
Taylor expanded in v around 0 49.8%
Taylor expanded in v around 0 75.1%
*-commutative75.1%
unpow275.1%
*-commutative75.1%
unpow275.1%
Simplified75.1%
if -5.29999999999999982 < r < 5.5999999999999996Initial program 83.3%
sub-neg83.3%
+-commutative83.3%
associate--l+83.3%
associate-/l*83.3%
distribute-neg-frac83.3%
associate-/r/83.3%
fma-def83.3%
sub-neg83.3%
Simplified83.3%
Taylor expanded in r around 0 91.5%
sub-neg91.5%
associate-*r/91.5%
metadata-eval91.5%
unpow291.5%
metadata-eval91.5%
Simplified91.5%
Final simplification83.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* r r) (* w w))))
(if (<= r -8.0)
(+ -1.5 (* -0.25 t_0))
(if (<= r 120.0) (+ -1.5 (/ 2.0 (* r r))) (+ -1.5 (* -0.375 t_0))))))
double code(double v, double w, double r) {
double t_0 = (r * r) * (w * w);
double tmp;
if (r <= -8.0) {
tmp = -1.5 + (-0.25 * t_0);
} else if (r <= 120.0) {
tmp = -1.5 + (2.0 / (r * r));
} else {
tmp = -1.5 + (-0.375 * 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 = (r * r) * (w * w)
if (r <= (-8.0d0)) then
tmp = (-1.5d0) + ((-0.25d0) * t_0)
else if (r <= 120.0d0) then
tmp = (-1.5d0) + (2.0d0 / (r * r))
else
tmp = (-1.5d0) + ((-0.375d0) * t_0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (r * r) * (w * w);
double tmp;
if (r <= -8.0) {
tmp = -1.5 + (-0.25 * t_0);
} else if (r <= 120.0) {
tmp = -1.5 + (2.0 / (r * r));
} else {
tmp = -1.5 + (-0.375 * t_0);
}
return tmp;
}
def code(v, w, r): t_0 = (r * r) * (w * w) tmp = 0 if r <= -8.0: tmp = -1.5 + (-0.25 * t_0) elif r <= 120.0: tmp = -1.5 + (2.0 / (r * r)) else: tmp = -1.5 + (-0.375 * t_0) return tmp
function code(v, w, r) t_0 = Float64(Float64(r * r) * Float64(w * w)) tmp = 0.0 if (r <= -8.0) tmp = Float64(-1.5 + Float64(-0.25 * t_0)); elseif (r <= 120.0) tmp = Float64(-1.5 + Float64(2.0 / Float64(r * r))); else tmp = Float64(-1.5 + Float64(-0.375 * t_0)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (r * r) * (w * w); tmp = 0.0; if (r <= -8.0) tmp = -1.5 + (-0.25 * t_0); elseif (r <= 120.0) tmp = -1.5 + (2.0 / (r * r)); else tmp = -1.5 + (-0.375 * t_0); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, -8.0], N[(-1.5 + N[(-0.25 * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 120.0], N[(-1.5 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.5 + N[(-0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(r \cdot r\right) \cdot \left(w \cdot w\right)\\
\mathbf{if}\;r \leq -8:\\
\;\;\;\;-1.5 + -0.25 \cdot t_0\\
\mathbf{elif}\;r \leq 120:\\
\;\;\;\;-1.5 + \frac{2}{r \cdot r}\\
\mathbf{else}:\\
\;\;\;\;-1.5 + -0.375 \cdot t_0\\
\end{array}
\end{array}
if r < -8Initial program 87.4%
sub-neg87.4%
+-commutative87.4%
associate--l+87.4%
associate-/l*98.3%
distribute-neg-frac98.3%
associate-/r/98.3%
fma-def98.3%
sub-neg98.3%
Simplified78.9%
Taylor expanded in r around inf 69.6%
sub-neg69.6%
associate-*r*72.5%
associate-/l*78.0%
*-commutative78.0%
unpow278.0%
unpow278.0%
swap-sqr98.7%
unpow298.7%
*-commutative98.7%
*-commutative98.7%
fma-neg98.7%
metadata-eval98.7%
metadata-eval98.7%
Simplified98.7%
unpow298.7%
unswap-sqr78.0%
div-inv78.0%
times-frac70.4%
Applied egg-rr70.4%
Taylor expanded in v around inf 71.9%
*-commutative71.9%
unpow271.9%
unpow271.9%
Simplified71.9%
if -8 < r < 120Initial program 83.3%
sub-neg83.3%
+-commutative83.3%
associate--l+83.3%
associate-/l*83.3%
distribute-neg-frac83.3%
associate-/r/83.3%
fma-def83.3%
sub-neg83.3%
Simplified83.3%
Taylor expanded in r around 0 91.5%
sub-neg91.5%
associate-*r/91.5%
metadata-eval91.5%
unpow291.5%
metadata-eval91.5%
Simplified91.5%
if 120 < r Initial program 93.5%
sub-neg93.5%
+-commutative93.5%
associate--l+93.5%
associate-/l*96.7%
distribute-neg-frac96.7%
associate-/r/96.6%
fma-def96.7%
sub-neg96.7%
Simplified84.4%
Taylor expanded in r around inf 69.1%
sub-neg69.1%
associate-*r*82.9%
associate-/l*84.5%
*-commutative84.5%
unpow284.5%
unpow284.5%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
*-commutative99.8%
fma-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
unpow299.8%
unswap-sqr84.5%
div-inv84.4%
times-frac70.3%
Applied egg-rr70.3%
Taylor expanded in v around 0 60.0%
Taylor expanded in v around 0 80.1%
*-commutative80.1%
unpow280.1%
*-commutative80.1%
unpow280.1%
Simplified80.1%
Final simplification83.8%
(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 86.6%
sub-neg86.6%
associate-/l*90.3%
cancel-sign-sub-inv90.3%
metadata-eval90.3%
*-commutative90.3%
*-commutative90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in v around 0 71.2%
unpow271.2%
unpow271.2%
Simplified71.2%
add-sqr-sqrt71.2%
unswap-sqr71.2%
unpow271.2%
sqrt-div71.2%
metadata-eval71.2%
unpow271.2%
sqrt-prod40.1%
add-sqr-sqrt58.8%
*-commutative58.8%
unswap-sqr68.9%
unpow268.9%
sqrt-div69.0%
metadata-eval69.0%
unpow269.0%
sqrt-prod45.7%
add-sqr-sqrt82.8%
*-commutative82.8%
Applied egg-rr82.8%
Taylor expanded in r around 0 49.8%
unpow249.8%
Simplified49.8%
Final simplification49.8%
(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 86.6%
sub-neg86.6%
+-commutative86.6%
associate--l+86.6%
associate-/l*90.3%
distribute-neg-frac90.3%
associate-/r/90.3%
fma-def90.3%
sub-neg90.3%
Simplified82.4%
Taylor expanded in r around 0 60.4%
sub-neg60.4%
associate-*r/60.4%
metadata-eval60.4%
unpow260.4%
metadata-eval60.4%
Simplified60.4%
Final simplification60.4%
herbie shell --seed 2023182
(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))