
(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 13 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 83.4%
sub-neg83.4%
+-commutative83.4%
associate--l+83.4%
associate-/l*86.2%
distribute-neg-frac86.2%
associate-/r/86.2%
fma-def86.2%
sub-neg86.2%
Simplified81.5%
fma-udef81.5%
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 (+ (- (+ 3.0 (/ 2.0 (* r r))) (/ (* 0.125 (+ 3.0 (* v -2.0))) (* (- 1.0 v) (pow (* r w) -2.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))) / ((1.0 - v) * pow((r * w), -2.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)))) / ((1.0d0 - v) * ((r * w) ** (-2.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))) / ((1.0 - v) * Math.pow((r * w), -2.0)))) + -4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * math.pow((r * w), -2.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(1.0 - v) * (Float64(r * w) ^ -2.0)))) + -4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * ((r * w) ^ -2.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[(N[(1.0 - v), $MachinePrecision] * N[Power[N[(r * w), $MachinePrecision], -2.0], $MachinePrecision]), $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(1 - v\right) \cdot {\left(r \cdot w\right)}^{-2}}\right) + -4.5
\end{array}
Initial program 83.4%
sub-neg83.4%
associate-/l*86.2%
cancel-sign-sub-inv86.2%
metadata-eval86.2%
*-commutative86.2%
*-commutative86.2%
metadata-eval86.2%
Simplified86.2%
div-inv86.2%
associate-*r*81.5%
unswap-sqr99.8%
pow299.8%
Applied egg-rr99.8%
pow199.8%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
unpow199.8%
*-commutative99.8%
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) (/ 1.0 (* (* r w) (* r w))))))))
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) * (1.0 / ((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 = (-4.5d0) + ((3.0d0 + (2.0d0 / (r * r))) - ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) / ((1.0d0 - v) * (1.0d0 / ((r * w) * (r * w))))))
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) * (1.0 / ((r * w) * (r * w))))));
}
def code(v, w, r): return -4.5 + ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * (1.0 / ((r * w) * (r * w))))))
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(1.0 / Float64(Float64(r * w) * Float64(r * w))))))) 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) * (1.0 / ((r * w) * (r * w)))))); 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[(1.0 / N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $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)}{\left(1 - v\right) \cdot \frac{1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 83.4%
sub-neg83.4%
associate-/l*86.2%
cancel-sign-sub-inv86.2%
metadata-eval86.2%
*-commutative86.2%
*-commutative86.2%
metadata-eval86.2%
Simplified86.2%
div-inv86.2%
associate-*r*81.5%
unswap-sqr99.8%
pow299.8%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= r -6e-104) (not (<= r 1.1e-130)))
(+
t_0
(- -1.5 (* (/ (+ 0.375 (* v -0.25)) (- 1.0 v)) (* r (* r (* w w))))))
t_0)))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((r <= -6e-104) || !(r <= 1.1e-130)) {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
} else {
tmp = 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-104)) .or. (.not. (r <= 1.1d-130))) then
tmp = t_0 + ((-1.5d0) - (((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)) * (r * (r * (w * w)))))
else
tmp = 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-104) || !(r <= 1.1e-130)) {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (r <= -6e-104) or not (r <= 1.1e-130): tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))) else: tmp = t_0 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((r <= -6e-104) || !(r <= 1.1e-130)) 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 = 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-104) || ~((r <= 1.1e-130))) tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))); else tmp = t_0; 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, -6e-104], N[Not[LessEqual[r, 1.1e-130]], $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], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq -6 \cdot 10^{-104} \lor \neg \left(r \leq 1.1 \cdot 10^{-130}\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\\
\end{array}
\end{array}
if r < -6.0000000000000005e-104 or 1.0999999999999999e-130 < r Initial program 89.1%
associate--l-89.1%
+-commutative89.1%
associate--l+89.1%
+-commutative89.1%
associate--r+89.1%
metadata-eval89.1%
associate-*l/93.3%
*-commutative93.3%
*-commutative93.3%
*-commutative93.3%
Simplified93.3%
if -6.0000000000000005e-104 < r < 1.0999999999999999e-130Initial program 72.1%
sub-neg72.1%
+-commutative72.1%
associate--l+72.1%
associate-/l*72.1%
distribute-neg-frac72.1%
associate-/r/72.1%
fma-def72.1%
sub-neg72.1%
Simplified72.1%
fma-udef72.1%
unswap-sqr99.9%
pow299.9%
div-inv99.9%
fma-def99.9%
pow299.9%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in r around 0 97.3%
unpow297.3%
Simplified97.3%
Final simplification94.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1 (+ t_0 (- (* -0.375 (* (* r r) (* w w))) 1.5)))
(t_2 (+ -4.5 (+ 3.0 (* -0.25 (* (* r w) (* r w)))))))
(if (<= r -10000000000.0)
t_2
(if (<= r -1.42e-99)
t_1
(if (<= r 1.1e-130) t_0 (if (<= r 2.6e+131) t_1 t_2))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
double t_2 = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w))));
double tmp;
if (r <= -10000000000.0) {
tmp = t_2;
} else if (r <= -1.42e-99) {
tmp = t_1;
} else if (r <= 1.1e-130) {
tmp = t_0;
} else if (r <= 2.6e+131) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = t_0 + (((-0.375d0) * ((r * r) * (w * w))) - 1.5d0)
t_2 = (-4.5d0) + (3.0d0 + ((-0.25d0) * ((r * w) * (r * w))))
if (r <= (-10000000000.0d0)) then
tmp = t_2
else if (r <= (-1.42d-99)) then
tmp = t_1
else if (r <= 1.1d-130) then
tmp = t_0
else if (r <= 2.6d+131) then
tmp = t_1
else
tmp = t_2
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 = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
double t_2 = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w))));
double tmp;
if (r <= -10000000000.0) {
tmp = t_2;
} else if (r <= -1.42e-99) {
tmp = t_1;
} else if (r <= 1.1e-130) {
tmp = t_0;
} else if (r <= 2.6e+131) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5) t_2 = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w)))) tmp = 0 if r <= -10000000000.0: tmp = t_2 elif r <= -1.42e-99: tmp = t_1 elif r <= 1.1e-130: tmp = t_0 elif r <= 2.6e+131: tmp = t_1 else: tmp = t_2 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(t_0 + Float64(Float64(-0.375 * Float64(Float64(r * r) * Float64(w * w))) - 1.5)) t_2 = Float64(-4.5 + Float64(3.0 + Float64(-0.25 * Float64(Float64(r * w) * Float64(r * w))))) tmp = 0.0 if (r <= -10000000000.0) tmp = t_2; elseif (r <= -1.42e-99) tmp = t_1; elseif (r <= 1.1e-130) tmp = t_0; elseif (r <= 2.6e+131) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5); t_2 = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w)))); tmp = 0.0; if (r <= -10000000000.0) tmp = t_2; elseif (r <= -1.42e-99) tmp = t_1; elseif (r <= 1.1e-130) tmp = t_0; elseif (r <= 2.6e+131) tmp = t_1; else tmp = t_2; 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[(t$95$0 + N[(N[(-0.375 * N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-4.5 + N[(3.0 + N[(-0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, -10000000000.0], t$95$2, If[LessEqual[r, -1.42e-99], t$95$1, If[LessEqual[r, 1.1e-130], t$95$0, If[LessEqual[r, 2.6e+131], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := t_0 + \left(-0.375 \cdot \left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) - 1.5\right)\\
t_2 := -4.5 + \left(3 + -0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\mathbf{if}\;r \leq -10000000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;r \leq -1.42 \cdot 10^{-99}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;r \leq 1.1 \cdot 10^{-130}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;r \leq 2.6 \cdot 10^{+131}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if r < -1e10 or 2.6e131 < r Initial program 85.3%
sub-neg85.3%
associate-/l*91.9%
cancel-sign-sub-inv91.9%
metadata-eval91.9%
*-commutative91.9%
*-commutative91.9%
metadata-eval91.9%
Simplified91.9%
Taylor expanded in v around inf 78.4%
*-commutative78.4%
*-commutative78.4%
unpow278.4%
unpow278.4%
swap-sqr92.4%
unpow292.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in r around inf 78.4%
*-commutative78.4%
unpow278.4%
unpow278.4%
swap-sqr92.4%
unpow292.4%
*-commutative92.4%
Simplified92.4%
unpow292.4%
Applied egg-rr92.4%
if -1e10 < r < -1.42e-99 or 1.0999999999999999e-130 < r < 2.6e131Initial program 93.7%
sub-neg93.7%
+-commutative93.7%
associate--l+93.7%
associate-/l*94.9%
distribute-neg-frac94.9%
associate-/r/94.9%
fma-def94.9%
sub-neg94.9%
Simplified94.9%
Taylor expanded in v around 0 88.5%
associate--l+88.5%
associate-*r/88.5%
metadata-eval88.5%
unpow288.5%
*-commutative88.5%
unpow288.5%
unpow288.5%
Simplified88.5%
if -1.42e-99 < r < 1.0999999999999999e-130Initial program 72.1%
sub-neg72.1%
+-commutative72.1%
associate--l+72.1%
associate-/l*72.1%
distribute-neg-frac72.1%
associate-/r/72.1%
fma-def72.1%
sub-neg72.1%
Simplified72.1%
fma-udef72.1%
unswap-sqr99.9%
pow299.9%
div-inv99.9%
fma-def99.9%
pow299.9%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in r around 0 97.3%
unpow297.3%
Simplified97.3%
Final simplification92.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1 (+ -4.5 (+ 3.0 (* -0.25 (* (* r w) (* r w))))))
(t_2 (* (* r r) (* w w))))
(if (<= r -5e+140)
t_1
(if (<= r -1.1e-100)
(+ t_0 (- (* -0.25 t_2) 1.5))
(if (<= r 1e-130)
t_0
(if (<= r 3.4e+131) (+ t_0 (- (* -0.375 t_2) 1.5)) t_1))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w))));
double t_2 = (r * r) * (w * w);
double tmp;
if (r <= -5e+140) {
tmp = t_1;
} else if (r <= -1.1e-100) {
tmp = t_0 + ((-0.25 * t_2) - 1.5);
} else if (r <= 1e-130) {
tmp = t_0;
} else if (r <= 3.4e+131) {
tmp = t_0 + ((-0.375 * t_2) - 1.5);
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = (-4.5d0) + (3.0d0 + ((-0.25d0) * ((r * w) * (r * w))))
t_2 = (r * r) * (w * w)
if (r <= (-5d+140)) then
tmp = t_1
else if (r <= (-1.1d-100)) then
tmp = t_0 + (((-0.25d0) * t_2) - 1.5d0)
else if (r <= 1d-130) then
tmp = t_0
else if (r <= 3.4d+131) then
tmp = t_0 + (((-0.375d0) * t_2) - 1.5d0)
else
tmp = t_1
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 = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w))));
double t_2 = (r * r) * (w * w);
double tmp;
if (r <= -5e+140) {
tmp = t_1;
} else if (r <= -1.1e-100) {
tmp = t_0 + ((-0.25 * t_2) - 1.5);
} else if (r <= 1e-130) {
tmp = t_0;
} else if (r <= 3.4e+131) {
tmp = t_0 + ((-0.375 * t_2) - 1.5);
} else {
tmp = t_1;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w)))) t_2 = (r * r) * (w * w) tmp = 0 if r <= -5e+140: tmp = t_1 elif r <= -1.1e-100: tmp = t_0 + ((-0.25 * t_2) - 1.5) elif r <= 1e-130: tmp = t_0 elif r <= 3.4e+131: tmp = t_0 + ((-0.375 * t_2) - 1.5) else: tmp = t_1 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(-4.5 + Float64(3.0 + Float64(-0.25 * Float64(Float64(r * w) * Float64(r * w))))) t_2 = Float64(Float64(r * r) * Float64(w * w)) tmp = 0.0 if (r <= -5e+140) tmp = t_1; elseif (r <= -1.1e-100) tmp = Float64(t_0 + Float64(Float64(-0.25 * t_2) - 1.5)); elseif (r <= 1e-130) tmp = t_0; elseif (r <= 3.4e+131) tmp = Float64(t_0 + Float64(Float64(-0.375 * t_2) - 1.5)); else tmp = t_1; end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w)))); t_2 = (r * r) * (w * w); tmp = 0.0; if (r <= -5e+140) tmp = t_1; elseif (r <= -1.1e-100) tmp = t_0 + ((-0.25 * t_2) - 1.5); elseif (r <= 1e-130) tmp = t_0; elseif (r <= 3.4e+131) tmp = t_0 + ((-0.375 * t_2) - 1.5); else tmp = t_1; 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[(-4.5 + N[(3.0 + N[(-0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, -5e+140], t$95$1, If[LessEqual[r, -1.1e-100], N[(t$95$0 + N[(N[(-0.25 * t$95$2), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 1e-130], t$95$0, If[LessEqual[r, 3.4e+131], N[(t$95$0 + N[(N[(-0.375 * t$95$2), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := -4.5 + \left(3 + -0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
t_2 := \left(r \cdot r\right) \cdot \left(w \cdot w\right)\\
\mathbf{if}\;r \leq -5 \cdot 10^{+140}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;r \leq -1.1 \cdot 10^{-100}:\\
\;\;\;\;t_0 + \left(-0.25 \cdot t_2 - 1.5\right)\\
\mathbf{elif}\;r \leq 10^{-130}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;r \leq 3.4 \cdot 10^{+131}:\\
\;\;\;\;t_0 + \left(-0.375 \cdot t_2 - 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if r < -5.00000000000000008e140 or 3.39999999999999986e131 < r Initial program 80.4%
sub-neg80.4%
associate-/l*89.3%
cancel-sign-sub-inv89.3%
metadata-eval89.3%
*-commutative89.3%
*-commutative89.3%
metadata-eval89.3%
Simplified89.3%
Taylor expanded in v around inf 72.1%
*-commutative72.1%
*-commutative72.1%
unpow272.1%
unpow272.1%
swap-sqr90.7%
unpow290.7%
*-commutative90.7%
Simplified90.7%
Taylor expanded in r around inf 72.1%
*-commutative72.1%
unpow272.1%
unpow272.1%
swap-sqr90.7%
unpow290.7%
*-commutative90.7%
Simplified90.7%
unpow290.7%
Applied egg-rr90.7%
if -5.00000000000000008e140 < r < -1.09999999999999995e-100Initial program 97.8%
sub-neg97.8%
+-commutative97.8%
associate--l+97.8%
associate-/l*99.9%
distribute-neg-frac99.9%
associate-/r/99.9%
fma-def99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in v around inf 94.6%
associate--l+94.6%
associate-*r/94.6%
metadata-eval94.6%
unpow294.6%
*-commutative94.6%
unpow294.6%
unpow294.6%
Simplified94.6%
if -1.09999999999999995e-100 < r < 1.0000000000000001e-130Initial program 72.1%
sub-neg72.1%
+-commutative72.1%
associate--l+72.1%
associate-/l*72.1%
distribute-neg-frac72.1%
associate-/r/72.1%
fma-def72.1%
sub-neg72.1%
Simplified72.1%
fma-udef72.1%
unswap-sqr99.9%
pow299.9%
div-inv99.9%
fma-def99.9%
pow299.9%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in r around 0 97.3%
unpow297.3%
Simplified97.3%
if 1.0000000000000001e-130 < r < 3.39999999999999986e131Initial program 93.0%
sub-neg93.0%
+-commutative93.0%
associate--l+93.0%
associate-/l*93.0%
distribute-neg-frac93.0%
associate-/r/93.0%
fma-def93.0%
sub-neg93.0%
Simplified93.0%
Taylor expanded in v around 0 88.6%
associate--l+88.6%
associate-*r/88.6%
metadata-eval88.6%
unpow288.6%
*-commutative88.6%
unpow288.6%
unpow288.6%
Simplified88.6%
Final simplification93.2%
(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 83.4%
associate--l-83.4%
+-commutative83.4%
associate--l+83.4%
+-commutative83.4%
associate--r+83.4%
metadata-eval83.4%
associate-*l/86.2%
*-commutative86.2%
*-commutative86.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in r around 0 86.2%
*-commutative86.2%
unpow286.2%
associate-*r*96.1%
*-commutative96.1%
Simplified96.1%
Final simplification96.1%
(FPCore (v w r) :precision binary64 (if (or (<= r -1.02e-62) (not (<= r 5e-8))) (+ -4.5 (+ 3.0 (* -0.25 (* w (* w (* r r)))))) (+ -1.5 (/ 2.0 (* r r)))))
double code(double v, double w, double r) {
double tmp;
if ((r <= -1.02e-62) || !(r <= 5e-8)) {
tmp = -4.5 + (3.0 + (-0.25 * (w * (w * (r * r)))));
} 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 <= (-1.02d-62)) .or. (.not. (r <= 5d-8))) then
tmp = (-4.5d0) + (3.0d0 + ((-0.25d0) * (w * (w * (r * r)))))
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 <= -1.02e-62) || !(r <= 5e-8)) {
tmp = -4.5 + (3.0 + (-0.25 * (w * (w * (r * r)))));
} else {
tmp = -1.5 + (2.0 / (r * r));
}
return tmp;
}
def code(v, w, r): tmp = 0 if (r <= -1.02e-62) or not (r <= 5e-8): tmp = -4.5 + (3.0 + (-0.25 * (w * (w * (r * r))))) else: tmp = -1.5 + (2.0 / (r * r)) return tmp
function code(v, w, r) tmp = 0.0 if ((r <= -1.02e-62) || !(r <= 5e-8)) tmp = Float64(-4.5 + Float64(3.0 + Float64(-0.25 * Float64(w * Float64(w * Float64(r * r)))))); 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 <= -1.02e-62) || ~((r <= 5e-8))) tmp = -4.5 + (3.0 + (-0.25 * (w * (w * (r * r))))); else tmp = -1.5 + (2.0 / (r * r)); end tmp_2 = tmp; end
code[v_, w_, r_] := If[Or[LessEqual[r, -1.02e-62], N[Not[LessEqual[r, 5e-8]], $MachinePrecision]], N[(-4.5 + N[(3.0 + N[(-0.25 * N[(w * N[(w * N[(r * r), $MachinePrecision]), $MachinePrecision]), $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 -1.02 \cdot 10^{-62} \lor \neg \left(r \leq 5 \cdot 10^{-8}\right):\\
\;\;\;\;-4.5 + \left(3 + -0.25 \cdot \left(w \cdot \left(w \cdot \left(r \cdot r\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \frac{2}{r \cdot r}\\
\end{array}
\end{array}
if r < -1.02000000000000005e-62 or 4.9999999999999998e-8 < r Initial program 89.1%
sub-neg89.1%
associate-/l*94.4%
cancel-sign-sub-inv94.4%
metadata-eval94.4%
*-commutative94.4%
*-commutative94.4%
metadata-eval94.4%
Simplified94.4%
Taylor expanded in v around inf 80.8%
*-commutative80.8%
*-commutative80.8%
unpow280.8%
unpow280.8%
swap-sqr90.4%
unpow290.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in r around inf 76.3%
*-commutative76.3%
unpow276.3%
unpow276.3%
swap-sqr85.9%
unpow285.9%
*-commutative85.9%
Simplified85.9%
unpow285.9%
unswap-sqr76.3%
associate-*l*76.6%
Applied egg-rr76.6%
if -1.02000000000000005e-62 < r < 4.9999999999999998e-8Initial program 77.1%
sub-neg77.1%
+-commutative77.1%
associate--l+77.1%
associate-/l*77.1%
distribute-neg-frac77.1%
associate-/r/77.1%
fma-def77.1%
sub-neg77.1%
Simplified77.1%
Taylor expanded in r around 0 90.6%
sub-neg90.6%
associate-*r/90.6%
metadata-eval90.6%
unpow290.6%
metadata-eval90.6%
Simplified90.6%
Final simplification83.2%
(FPCore (v w r) :precision binary64 (if (or (<= r -1.02e-62) (not (<= r 4.6e-8))) (+ -4.5 (+ 3.0 (* -0.25 (* (* r w) (* r w))))) (+ -1.5 (/ 2.0 (* r r)))))
double code(double v, double w, double r) {
double tmp;
if ((r <= -1.02e-62) || !(r <= 4.6e-8)) {
tmp = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * 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 <= (-1.02d-62)) .or. (.not. (r <= 4.6d-8))) then
tmp = (-4.5d0) + (3.0d0 + ((-0.25d0) * ((r * w) * (r * 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 <= -1.02e-62) || !(r <= 4.6e-8)) {
tmp = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w))));
} else {
tmp = -1.5 + (2.0 / (r * r));
}
return tmp;
}
def code(v, w, r): tmp = 0 if (r <= -1.02e-62) or not (r <= 4.6e-8): tmp = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w)))) else: tmp = -1.5 + (2.0 / (r * r)) return tmp
function code(v, w, r) tmp = 0.0 if ((r <= -1.02e-62) || !(r <= 4.6e-8)) tmp = Float64(-4.5 + Float64(3.0 + Float64(-0.25 * Float64(Float64(r * w) * Float64(r * 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 <= -1.02e-62) || ~((r <= 4.6e-8))) tmp = -4.5 + (3.0 + (-0.25 * ((r * w) * (r * w)))); else tmp = -1.5 + (2.0 / (r * r)); end tmp_2 = tmp; end
code[v_, w_, r_] := If[Or[LessEqual[r, -1.02e-62], N[Not[LessEqual[r, 4.6e-8]], $MachinePrecision]], N[(-4.5 + N[(3.0 + N[(-0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $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 -1.02 \cdot 10^{-62} \lor \neg \left(r \leq 4.6 \cdot 10^{-8}\right):\\
\;\;\;\;-4.5 + \left(3 + -0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \frac{2}{r \cdot r}\\
\end{array}
\end{array}
if r < -1.02000000000000005e-62 or 4.6000000000000002e-8 < r Initial program 89.1%
sub-neg89.1%
associate-/l*94.4%
cancel-sign-sub-inv94.4%
metadata-eval94.4%
*-commutative94.4%
*-commutative94.4%
metadata-eval94.4%
Simplified94.4%
Taylor expanded in v around inf 80.8%
*-commutative80.8%
*-commutative80.8%
unpow280.8%
unpow280.8%
swap-sqr90.4%
unpow290.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in r around inf 76.3%
*-commutative76.3%
unpow276.3%
unpow276.3%
swap-sqr85.9%
unpow285.9%
*-commutative85.9%
Simplified85.9%
unpow285.9%
Applied egg-rr85.9%
if -1.02000000000000005e-62 < r < 4.6000000000000002e-8Initial program 77.1%
sub-neg77.1%
+-commutative77.1%
associate--l+77.1%
associate-/l*77.1%
distribute-neg-frac77.1%
associate-/r/77.1%
fma-def77.1%
sub-neg77.1%
Simplified77.1%
Taylor expanded in r around 0 90.6%
sub-neg90.6%
associate-*r/90.6%
metadata-eval90.6%
unpow290.6%
metadata-eval90.6%
Simplified90.6%
Final simplification88.1%
(FPCore (v w r) :precision binary64 (if (or (<= r -1.8e+33) (not (<= r 6.4e+91))) (* -0.25 (* (* r r) (* w w))) (+ -1.5 (/ 2.0 (* r r)))))
double code(double v, double w, double r) {
double tmp;
if ((r <= -1.8e+33) || !(r <= 6.4e+91)) {
tmp = -0.25 * ((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 <= (-1.8d+33)) .or. (.not. (r <= 6.4d+91))) then
tmp = (-0.25d0) * ((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 <= -1.8e+33) || !(r <= 6.4e+91)) {
tmp = -0.25 * ((r * r) * (w * w));
} else {
tmp = -1.5 + (2.0 / (r * r));
}
return tmp;
}
def code(v, w, r): tmp = 0 if (r <= -1.8e+33) or not (r <= 6.4e+91): tmp = -0.25 * ((r * r) * (w * w)) else: tmp = -1.5 + (2.0 / (r * r)) return tmp
function code(v, w, r) tmp = 0.0 if ((r <= -1.8e+33) || !(r <= 6.4e+91)) tmp = Float64(-0.25 * 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 <= -1.8e+33) || ~((r <= 6.4e+91))) tmp = -0.25 * ((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, -1.8e+33], N[Not[LessEqual[r, 6.4e+91]], $MachinePrecision]], N[(-0.25 * N[(N[(r * r), $MachinePrecision] * N[(w * w), $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 -1.8 \cdot 10^{+33} \lor \neg \left(r \leq 6.4 \cdot 10^{+91}\right):\\
\;\;\;\;-0.25 \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 < -1.8000000000000001e33 or 6.39999999999999979e91 < r Initial program 85.3%
sub-neg85.3%
associate-/l*91.9%
cancel-sign-sub-inv91.9%
metadata-eval91.9%
*-commutative91.9%
*-commutative91.9%
metadata-eval91.9%
Simplified91.9%
Taylor expanded in v around inf 76.4%
*-commutative76.4%
*-commutative76.4%
unpow276.4%
unpow276.4%
swap-sqr90.4%
unpow290.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in r around inf 76.4%
*-commutative76.4%
unpow276.4%
unpow276.4%
swap-sqr90.4%
unpow290.4%
*-commutative90.4%
Simplified90.4%
unpow290.4%
unswap-sqr76.4%
Applied egg-rr76.4%
Taylor expanded in w around inf 66.1%
*-commutative66.1%
unpow266.1%
unpow266.1%
Simplified66.1%
if -1.8000000000000001e33 < r < 6.39999999999999979e91Initial program 82.3%
sub-neg82.3%
+-commutative82.3%
associate--l+82.3%
associate-/l*82.9%
distribute-neg-frac82.9%
associate-/r/82.9%
fma-def82.9%
sub-neg82.9%
Simplified82.9%
Taylor expanded in r around 0 82.7%
sub-neg82.7%
associate-*r/82.7%
metadata-eval82.7%
unpow282.7%
metadata-eval82.7%
Simplified82.7%
Final simplification76.6%
(FPCore (v w r) :precision binary64 (if (<= r -1.15) -1.5 (if (<= r 9.2e-8) (/ 2.0 (* r r)) -1.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= -1.15) {
tmp = -1.5;
} else if (r <= 9.2e-8) {
tmp = 2.0 / (r * r);
} else {
tmp = -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.15d0)) then
tmp = -1.5d0
else if (r <= 9.2d-8) then
tmp = 2.0d0 / (r * r)
else
tmp = -1.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= -1.15) {
tmp = -1.5;
} else if (r <= 9.2e-8) {
tmp = 2.0 / (r * r);
} else {
tmp = -1.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= -1.15: tmp = -1.5 elif r <= 9.2e-8: tmp = 2.0 / (r * r) else: tmp = -1.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= -1.15) tmp = -1.5; elseif (r <= 9.2e-8) tmp = Float64(2.0 / Float64(r * r)); else tmp = -1.5; end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= -1.15) tmp = -1.5; elseif (r <= 9.2e-8) tmp = 2.0 / (r * r); else tmp = -1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, -1.15], -1.5, If[LessEqual[r, 9.2e-8], N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision], -1.5]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq -1.15:\\
\;\;\;\;-1.5\\
\mathbf{elif}\;r \leq 9.2 \cdot 10^{-8}:\\
\;\;\;\;\frac{2}{r \cdot r}\\
\mathbf{else}:\\
\;\;\;\;-1.5\\
\end{array}
\end{array}
if r < -1.1499999999999999 or 9.2000000000000003e-8 < r Initial program 88.8%
sub-neg88.8%
associate-/l*93.8%
cancel-sign-sub-inv93.8%
metadata-eval93.8%
*-commutative93.8%
*-commutative93.8%
metadata-eval93.8%
Simplified93.8%
Taylor expanded in v around inf 80.2%
*-commutative80.2%
*-commutative80.2%
unpow280.2%
unpow280.2%
swap-sqr90.7%
unpow290.7%
*-commutative90.7%
Simplified90.7%
Taylor expanded in r around inf 79.3%
*-commutative79.3%
unpow279.3%
unpow279.3%
swap-sqr89.8%
unpow289.8%
*-commutative89.8%
Simplified89.8%
unpow289.8%
unswap-sqr79.3%
Applied egg-rr79.3%
Taylor expanded in w around 0 29.9%
if -1.1499999999999999 < r < 9.2000000000000003e-8Initial program 78.4%
sub-neg78.4%
+-commutative78.4%
associate--l+78.4%
associate-/l*79.1%
distribute-neg-frac79.1%
associate-/r/79.1%
fma-def79.1%
sub-neg79.1%
Simplified79.1%
fma-udef79.1%
unswap-sqr99.8%
pow299.8%
div-inv99.8%
fma-def99.8%
pow299.8%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in r around 0 85.3%
unpow285.3%
Simplified85.3%
Final simplification58.7%
(FPCore (v w r) :precision binary64 (+ -1.5 (/ 2.0 (* r r))))
double code(double v, double w, double r) {
return -1.5 + (2.0 / (r * r));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (-1.5d0) + (2.0d0 / (r * r))
end function
public static double code(double v, double w, double r) {
return -1.5 + (2.0 / (r * r));
}
def code(v, w, r): return -1.5 + (2.0 / (r * r))
function code(v, w, r) return Float64(-1.5 + Float64(2.0 / Float64(r * r))) end
function tmp = code(v, w, r) tmp = -1.5 + (2.0 / (r * r)); end
code[v_, w_, r_] := N[(-1.5 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 + \frac{2}{r \cdot r}
\end{array}
Initial program 83.4%
sub-neg83.4%
+-commutative83.4%
associate--l+83.4%
associate-/l*86.2%
distribute-neg-frac86.2%
associate-/r/86.2%
fma-def86.2%
sub-neg86.2%
Simplified81.5%
Taylor expanded in r around 0 59.6%
sub-neg59.6%
associate-*r/59.6%
metadata-eval59.6%
unpow259.6%
metadata-eval59.6%
Simplified59.6%
Final simplification59.6%
(FPCore (v w r) :precision binary64 -1.5)
double code(double v, double w, double r) {
return -1.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = -1.5d0
end function
public static double code(double v, double w, double r) {
return -1.5;
}
def code(v, w, r): return -1.5
function code(v, w, r) return -1.5 end
function tmp = code(v, w, r) tmp = -1.5; end
code[v_, w_, r_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 83.4%
sub-neg83.4%
associate-/l*86.2%
cancel-sign-sub-inv86.2%
metadata-eval86.2%
*-commutative86.2%
*-commutative86.2%
metadata-eval86.2%
Simplified86.2%
Taylor expanded in v around inf 78.7%
*-commutative78.7%
*-commutative78.7%
unpow278.7%
unpow278.7%
swap-sqr93.9%
unpow293.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in r around inf 42.7%
*-commutative42.7%
unpow242.7%
unpow242.7%
swap-sqr49.0%
unpow249.0%
*-commutative49.0%
Simplified49.0%
unpow249.0%
unswap-sqr42.7%
Applied egg-rr42.7%
Taylor expanded in w around 0 15.0%
Final simplification15.0%
herbie shell --seed 2023194
(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))