
(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 10 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.2%
sub-neg83.2%
+-commutative83.2%
associate--l+83.2%
associate-/l*87.2%
distribute-neg-frac87.2%
associate-/r/87.2%
fma-def87.2%
sub-neg87.2%
Simplified81.0%
fma-udef81.0%
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
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (+ 3.0 t_0)))
(if (<= (* w w) 0.0)
(+ -4.5 (- t_1 (* 0.375 (* (* r w) (* r w)))))
(if (<= (* w w) 2e+274)
(+
t_0
(- -1.5 (* (/ (+ 0.375 (* v -0.25)) (- 1.0 v)) (* r (* r (* w w))))))
(+ -4.5 (- t_1 (* 0.375 (* w (* w (* r r))))))))))
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 ((w * w) <= 0.0) {
tmp = -4.5 + (t_1 - (0.375 * ((r * w) * (r * w))));
} else if ((w * w) <= 2e+274) {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
} else {
tmp = -4.5 + (t_1 - (0.375 * (w * (w * (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = 3.0d0 + t_0
if ((w * w) <= 0.0d0) then
tmp = (-4.5d0) + (t_1 - (0.375d0 * ((r * w) * (r * w))))
else if ((w * w) <= 2d+274) then
tmp = t_0 + ((-1.5d0) - (((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)) * (r * (r * (w * w)))))
else
tmp = (-4.5d0) + (t_1 - (0.375d0 * (w * (w * (r * r)))))
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 ((w * w) <= 0.0) {
tmp = -4.5 + (t_1 - (0.375 * ((r * w) * (r * w))));
} else if ((w * w) <= 2e+274) {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
} else {
tmp = -4.5 + (t_1 - (0.375 * (w * (w * (r * r)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = 3.0 + t_0 tmp = 0 if (w * w) <= 0.0: tmp = -4.5 + (t_1 - (0.375 * ((r * w) * (r * w)))) elif (w * w) <= 2e+274: tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))) else: tmp = -4.5 + (t_1 - (0.375 * (w * (w * (r * r))))) 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 (Float64(w * w) <= 0.0) tmp = Float64(-4.5 + Float64(t_1 - Float64(0.375 * Float64(Float64(r * w) * Float64(r * w))))); elseif (Float64(w * w) <= 2e+274) 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(-4.5 + Float64(t_1 - Float64(0.375 * Float64(w * Float64(w * Float64(r * r)))))); 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 ((w * w) <= 0.0) tmp = -4.5 + (t_1 - (0.375 * ((r * w) * (r * w)))); elseif ((w * w) <= 2e+274) tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))); else tmp = -4.5 + (t_1 - (0.375 * (w * (w * (r * r))))); 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[N[(w * w), $MachinePrecision], 0.0], N[(-4.5 + N[(t$95$1 - N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(w * w), $MachinePrecision], 2e+274], 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[(-4.5 + N[(t$95$1 - N[(0.375 * N[(w * N[(w * N[(r * r), $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}\;w \cdot w \leq 0:\\
\;\;\;\;-4.5 + \left(t_1 - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\mathbf{elif}\;w \cdot w \leq 2 \cdot 10^{+274}:\\
\;\;\;\;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}:\\
\;\;\;\;-4.5 + \left(t_1 - 0.375 \cdot \left(w \cdot \left(w \cdot \left(r \cdot r\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 0.0Initial program 87.3%
sub-neg87.3%
associate-/l*87.3%
cancel-sign-sub-inv87.3%
metadata-eval87.3%
*-commutative87.3%
*-commutative87.3%
metadata-eval87.3%
Simplified87.3%
Taylor expanded in v around 0 73.9%
*-commutative73.9%
*-commutative73.9%
unpow273.9%
unpow273.9%
swap-sqr95.2%
unpow295.2%
*-commutative95.2%
Simplified95.2%
unpow295.2%
Applied egg-rr95.2%
if 0.0 < (*.f64 w w) < 1.99999999999999984e274Initial program 92.5%
associate--l-92.5%
+-commutative92.5%
associate--l+92.5%
+-commutative92.5%
associate--r+92.5%
metadata-eval92.5%
associate-*l/99.8%
*-commutative99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
if 1.99999999999999984e274 < (*.f64 w w) Initial program 58.0%
sub-neg58.0%
associate-/l*58.0%
cancel-sign-sub-inv58.0%
metadata-eval58.0%
*-commutative58.0%
*-commutative58.0%
metadata-eval58.0%
Simplified58.0%
Taylor expanded in v around 0 58.0%
*-commutative58.0%
*-commutative58.0%
unpow258.0%
unpow258.0%
swap-sqr97.3%
unpow297.3%
*-commutative97.3%
Simplified97.3%
unpow297.3%
unswap-sqr58.0%
associate-*l*97.3%
Applied egg-rr97.3%
Final simplification98.2%
(FPCore (v w r) :precision binary64 (+ (- (+ 3.0 (/ 2.0 (* r r))) (/ (* 0.125 (+ 3.0 (* v -2.0))) (* (- 1.0 v) (/ (/ 1.0 (* r w)) (* r w))))) -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) * ((1.0 / (r * w)) / (r * w))))) + -4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) / ((1.0d0 - v) * ((1.0d0 / (r * w)) / (r * w))))) + (-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) * ((1.0 / (r * w)) / (r * w))))) + -4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (v * -2.0))) / ((1.0 - v) * ((1.0 / (r * w)) / (r * w))))) + -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(Float64(1.0 / Float64(r * w)) / Float64(r * w))))) + -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) * ((1.0 / (r * w)) / (r * w))))) + -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[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $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 \frac{\frac{1}{r \cdot w}}{r \cdot w}}\right) + -4.5
\end{array}
Initial program 83.2%
sub-neg83.2%
associate-/l*87.2%
cancel-sign-sub-inv87.2%
metadata-eval87.2%
*-commutative87.2%
*-commutative87.2%
metadata-eval87.2%
Simplified87.2%
clear-num87.2%
inv-pow87.2%
associate-*r*81.0%
unswap-sqr99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in r around 0 81.0%
unpow281.0%
*-commutative81.0%
unpow281.0%
swap-sqr99.7%
unpow299.7%
remove-double-div99.7%
associate-/r/99.7%
metadata-eval99.7%
associate-*l/99.7%
unpow299.7%
associate-/r*99.7%
*-rgt-identity99.7%
associate-*r/99.7%
unpow-199.7%
unpow-199.7%
pow-sqr99.7%
metadata-eval99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
*-commutative99.7%
metadata-eval99.7%
pow-div99.7%
inv-pow99.7%
pow199.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= (* w w) 2e+274)
(+
t_0
(- -1.5 (* (* r (* w (* r w))) (/ (+ 0.375 (* v -0.25)) (- 1.0 v)))))
(+ -4.5 (- (+ 3.0 t_0) (* 0.375 (* w (* w (* r r)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 2e+274) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
} else {
tmp = -4.5 + ((3.0 + t_0) - (0.375 * (w * (w * (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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((w * w) <= 2d+274) then
tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * ((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v))))
else
tmp = (-4.5d0) + ((3.0d0 + t_0) - (0.375d0 * (w * (w * (r * r)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 2e+274) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
} else {
tmp = -4.5 + ((3.0 + t_0) - (0.375 * (w * (w * (r * r)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (w * w) <= 2e+274: tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))) else: tmp = -4.5 + ((3.0 + t_0) - (0.375 * (w * (w * (r * r))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(w * w) <= 2e+274) 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(-4.5 + Float64(Float64(3.0 + t_0) - Float64(0.375 * Float64(w * Float64(w * Float64(r * r)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((w * w) <= 2e+274) tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))); else tmp = -4.5 + ((3.0 + t_0) - (0.375 * (w * (w * (r * r))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(w * w), $MachinePrecision], 2e+274], 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[(-4.5 + N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(0.375 * N[(w * N[(w * N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \cdot w \leq 2 \cdot 10^{+274}:\\
\;\;\;\;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}:\\
\;\;\;\;-4.5 + \left(\left(3 + t_0\right) - 0.375 \cdot \left(w \cdot \left(w \cdot \left(r \cdot r\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 1.99999999999999984e274Initial program 91.1%
associate--l-91.1%
+-commutative91.1%
associate--l+91.1%
+-commutative91.1%
associate--r+91.1%
metadata-eval91.1%
associate-*l/96.3%
*-commutative96.3%
*-commutative96.3%
*-commutative96.3%
Simplified96.3%
Taylor expanded in r around 0 96.3%
*-commutative96.3%
unpow296.3%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
if 1.99999999999999984e274 < (*.f64 w w) Initial program 58.0%
sub-neg58.0%
associate-/l*58.0%
cancel-sign-sub-inv58.0%
metadata-eval58.0%
*-commutative58.0%
*-commutative58.0%
metadata-eval58.0%
Simplified58.0%
Taylor expanded in v around 0 58.0%
*-commutative58.0%
*-commutative58.0%
unpow258.0%
unpow258.0%
swap-sqr97.3%
unpow297.3%
*-commutative97.3%
Simplified97.3%
unpow297.3%
unswap-sqr58.0%
associate-*l*97.3%
Applied egg-rr97.3%
Final simplification99.2%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* w (* w (* r r)))) (t_1 (+ 3.0 (/ 2.0 (* r r)))))
(if (or (<= v -50.0) (not (<= v 2.35e-12)))
(+ -4.5 (- t_1 (* 0.25 t_0)))
(+ -4.5 (- t_1 (* 0.375 t_0))))))
double code(double v, double w, double r) {
double t_0 = w * (w * (r * r));
double t_1 = 3.0 + (2.0 / (r * r));
double tmp;
if ((v <= -50.0) || !(v <= 2.35e-12)) {
tmp = -4.5 + (t_1 - (0.25 * t_0));
} else {
tmp = -4.5 + (t_1 - (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) :: t_1
real(8) :: tmp
t_0 = w * (w * (r * r))
t_1 = 3.0d0 + (2.0d0 / (r * r))
if ((v <= (-50.0d0)) .or. (.not. (v <= 2.35d-12))) then
tmp = (-4.5d0) + (t_1 - (0.25d0 * t_0))
else
tmp = (-4.5d0) + (t_1 - (0.375d0 * t_0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = w * (w * (r * r));
double t_1 = 3.0 + (2.0 / (r * r));
double tmp;
if ((v <= -50.0) || !(v <= 2.35e-12)) {
tmp = -4.5 + (t_1 - (0.25 * t_0));
} else {
tmp = -4.5 + (t_1 - (0.375 * t_0));
}
return tmp;
}
def code(v, w, r): t_0 = w * (w * (r * r)) t_1 = 3.0 + (2.0 / (r * r)) tmp = 0 if (v <= -50.0) or not (v <= 2.35e-12): tmp = -4.5 + (t_1 - (0.25 * t_0)) else: tmp = -4.5 + (t_1 - (0.375 * t_0)) return tmp
function code(v, w, r) t_0 = Float64(w * Float64(w * Float64(r * r))) t_1 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if ((v <= -50.0) || !(v <= 2.35e-12)) tmp = Float64(-4.5 + Float64(t_1 - Float64(0.25 * t_0))); else tmp = Float64(-4.5 + Float64(t_1 - Float64(0.375 * t_0))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = w * (w * (r * r)); t_1 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if ((v <= -50.0) || ~((v <= 2.35e-12))) tmp = -4.5 + (t_1 - (0.25 * t_0)); else tmp = -4.5 + (t_1 - (0.375 * t_0)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(w * N[(w * N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -50.0], N[Not[LessEqual[v, 2.35e-12]], $MachinePrecision]], N[(-4.5 + N[(t$95$1 - N[(0.25 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(t$95$1 - N[(0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := w \cdot \left(w \cdot \left(r \cdot r\right)\right)\\
t_1 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -50 \lor \neg \left(v \leq 2.35 \cdot 10^{-12}\right):\\
\;\;\;\;-4.5 + \left(t_1 - 0.25 \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(t_1 - 0.375 \cdot t_0\right)\\
\end{array}
\end{array}
if v < -50 or 2.34999999999999988e-12 < v Initial program 79.9%
sub-neg79.9%
associate-/l*88.4%
cancel-sign-sub-inv88.4%
metadata-eval88.4%
*-commutative88.4%
*-commutative88.4%
metadata-eval88.4%
Simplified88.4%
clear-num88.4%
inv-pow88.4%
associate-*r*83.4%
unswap-sqr99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in r around 0 83.4%
unpow283.4%
*-commutative83.4%
unpow283.4%
swap-sqr99.7%
unpow299.7%
remove-double-div99.7%
associate-/r/99.7%
metadata-eval99.7%
associate-*l/99.7%
unpow299.7%
associate-/r*99.8%
*-rgt-identity99.8%
associate-*r/99.7%
unpow-199.7%
unpow-199.7%
pow-sqr99.7%
metadata-eval99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
*-commutative99.7%
metadata-eval99.7%
pow-div99.8%
inv-pow99.8%
pow199.8%
*-commutative99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 82.8%
*-commutative82.8%
unpow282.8%
associate-*r*92.1%
unpow292.1%
Simplified92.1%
if -50 < v < 2.34999999999999988e-12Initial program 86.1%
sub-neg86.1%
associate-/l*86.1%
cancel-sign-sub-inv86.1%
metadata-eval86.1%
*-commutative86.1%
*-commutative86.1%
metadata-eval86.1%
Simplified86.1%
Taylor expanded in v around 0 78.4%
*-commutative78.4%
*-commutative78.4%
unpow278.4%
unpow278.4%
swap-sqr99.2%
unpow299.2%
*-commutative99.2%
Simplified99.2%
unpow299.2%
unswap-sqr78.4%
associate-*l*89.5%
Applied egg-rr89.5%
Final simplification90.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= w 4.4e-164)
(+ -1.5 t_0)
(if (<= w 1.6e+50)
(+ t_0 (- (* -0.375 (* (* r r) (* w w))) 1.5))
(+ -4.5 (- (+ 3.0 t_0) (* 0.25 (* w (* w (* r r))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (w <= 4.4e-164) {
tmp = -1.5 + t_0;
} else if (w <= 1.6e+50) {
tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
} else {
tmp = -4.5 + ((3.0 + t_0) - (0.25 * (w * (w * (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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (w <= 4.4d-164) then
tmp = (-1.5d0) + t_0
else if (w <= 1.6d+50) then
tmp = t_0 + (((-0.375d0) * ((r * r) * (w * w))) - 1.5d0)
else
tmp = (-4.5d0) + ((3.0d0 + t_0) - (0.25d0 * (w * (w * (r * r)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (w <= 4.4e-164) {
tmp = -1.5 + t_0;
} else if (w <= 1.6e+50) {
tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
} else {
tmp = -4.5 + ((3.0 + t_0) - (0.25 * (w * (w * (r * r)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if w <= 4.4e-164: tmp = -1.5 + t_0 elif w <= 1.6e+50: tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5) else: tmp = -4.5 + ((3.0 + t_0) - (0.25 * (w * (w * (r * r))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (w <= 4.4e-164) tmp = Float64(-1.5 + t_0); elseif (w <= 1.6e+50) tmp = Float64(t_0 + Float64(Float64(-0.375 * Float64(Float64(r * r) * Float64(w * w))) - 1.5)); else tmp = Float64(-4.5 + Float64(Float64(3.0 + t_0) - Float64(0.25 * Float64(w * Float64(w * Float64(r * r)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (w <= 4.4e-164) tmp = -1.5 + t_0; elseif (w <= 1.6e+50) tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5); else tmp = -4.5 + ((3.0 + t_0) - (0.25 * (w * (w * (r * r))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, 4.4e-164], N[(-1.5 + t$95$0), $MachinePrecision], If[LessEqual[w, 1.6e+50], N[(t$95$0 + N[(N[(-0.375 * N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(0.25 * N[(w * N[(w * N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \leq 4.4 \cdot 10^{-164}:\\
\;\;\;\;-1.5 + t_0\\
\mathbf{elif}\;w \leq 1.6 \cdot 10^{+50}:\\
\;\;\;\;t_0 + \left(-0.375 \cdot \left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) - 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(\left(3 + t_0\right) - 0.25 \cdot \left(w \cdot \left(w \cdot \left(r \cdot r\right)\right)\right)\right)\\
\end{array}
\end{array}
if w < 4.39999999999999975e-164Initial program 84.6%
sub-neg84.6%
+-commutative84.6%
associate--l+84.6%
associate-/l*86.4%
distribute-neg-frac86.4%
associate-/r/86.4%
fma-def86.4%
sub-neg86.4%
Simplified78.3%
Taylor expanded in r around 0 61.9%
sub-neg61.9%
associate-*r/61.9%
metadata-eval61.9%
unpow261.9%
metadata-eval61.9%
Simplified61.9%
if 4.39999999999999975e-164 < w < 1.59999999999999991e50Initial program 91.4%
sub-neg91.4%
+-commutative91.4%
associate--l+91.4%
associate-/l*99.8%
distribute-neg-frac99.8%
associate-/r/99.8%
fma-def99.9%
sub-neg99.9%
Simplified93.4%
Taylor expanded in v around 0 85.2%
associate--l+85.2%
associate-*r/85.2%
metadata-eval85.2%
unpow285.2%
*-commutative85.2%
unpow285.2%
unpow285.2%
Simplified85.2%
if 1.59999999999999991e50 < w Initial program 71.8%
sub-neg71.8%
associate-/l*78.8%
cancel-sign-sub-inv78.8%
metadata-eval78.8%
*-commutative78.8%
*-commutative78.8%
metadata-eval78.8%
Simplified78.8%
clear-num78.8%
inv-pow78.8%
associate-*r*78.9%
unswap-sqr99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in r around 0 78.9%
unpow278.9%
*-commutative78.9%
unpow278.9%
swap-sqr99.8%
unpow299.8%
remove-double-div99.8%
associate-/r/99.8%
metadata-eval99.8%
associate-*l/99.8%
unpow299.8%
associate-/r*99.9%
*-rgt-identity99.9%
associate-*r/99.8%
unpow-199.8%
unpow-199.8%
pow-sqr99.8%
metadata-eval99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
*-commutative99.8%
metadata-eval99.8%
pow-div99.9%
inv-pow99.9%
pow199.9%
*-commutative99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in v around inf 77.4%
*-commutative77.4%
unpow277.4%
associate-*r*96.9%
unpow296.9%
Simplified96.9%
Final simplification73.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* r r) (* w w))) (t_1 (/ 2.0 (* r r))))
(if (<= r 6.5e-127)
(+ -1.5 t_1)
(if (<= r 1800000000000.0)
(+ t_1 (- (* -0.25 t_0) 1.5))
(+ t_1 (- (* -0.375 t_0) 1.5))))))
double code(double v, double w, double r) {
double t_0 = (r * r) * (w * w);
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 6.5e-127) {
tmp = -1.5 + t_1;
} else if (r <= 1800000000000.0) {
tmp = t_1 + ((-0.25 * t_0) - 1.5);
} else {
tmp = t_1 + ((-0.375 * t_0) - 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 = (r * r) * (w * w)
t_1 = 2.0d0 / (r * r)
if (r <= 6.5d-127) then
tmp = (-1.5d0) + t_1
else if (r <= 1800000000000.0d0) then
tmp = t_1 + (((-0.25d0) * t_0) - 1.5d0)
else
tmp = t_1 + (((-0.375d0) * t_0) - 1.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (r * r) * (w * w);
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 6.5e-127) {
tmp = -1.5 + t_1;
} else if (r <= 1800000000000.0) {
tmp = t_1 + ((-0.25 * t_0) - 1.5);
} else {
tmp = t_1 + ((-0.375 * t_0) - 1.5);
}
return tmp;
}
def code(v, w, r): t_0 = (r * r) * (w * w) t_1 = 2.0 / (r * r) tmp = 0 if r <= 6.5e-127: tmp = -1.5 + t_1 elif r <= 1800000000000.0: tmp = t_1 + ((-0.25 * t_0) - 1.5) else: tmp = t_1 + ((-0.375 * t_0) - 1.5) return tmp
function code(v, w, r) t_0 = Float64(Float64(r * r) * Float64(w * w)) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 6.5e-127) tmp = Float64(-1.5 + t_1); elseif (r <= 1800000000000.0) tmp = Float64(t_1 + Float64(Float64(-0.25 * t_0) - 1.5)); else tmp = Float64(t_1 + Float64(Float64(-0.375 * t_0) - 1.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (r * r) * (w * w); t_1 = 2.0 / (r * r); tmp = 0.0; if (r <= 6.5e-127) tmp = -1.5 + t_1; elseif (r <= 1800000000000.0) tmp = t_1 + ((-0.25 * t_0) - 1.5); else tmp = t_1 + ((-0.375 * t_0) - 1.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 6.5e-127], N[(-1.5 + t$95$1), $MachinePrecision], If[LessEqual[r, 1800000000000.0], N[(t$95$1 + N[(N[(-0.25 * t$95$0), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(-0.375 * t$95$0), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(r \cdot r\right) \cdot \left(w \cdot w\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 6.5 \cdot 10^{-127}:\\
\;\;\;\;-1.5 + t_1\\
\mathbf{elif}\;r \leq 1800000000000:\\
\;\;\;\;t_1 + \left(-0.25 \cdot t_0 - 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(-0.375 \cdot t_0 - 1.5\right)\\
\end{array}
\end{array}
if r < 6.49999999999999998e-127Initial program 82.9%
sub-neg82.9%
+-commutative82.9%
associate--l+82.9%
associate-/l*84.1%
distribute-neg-frac84.1%
associate-/r/84.1%
fma-def84.1%
sub-neg84.1%
Simplified80.0%
Taylor expanded in r around 0 68.8%
sub-neg68.8%
associate-*r/68.8%
metadata-eval68.8%
unpow268.8%
metadata-eval68.8%
Simplified68.8%
if 6.49999999999999998e-127 < r < 1.8e12Initial program 77.5%
sub-neg77.5%
+-commutative77.5%
associate--l+77.5%
associate-/l*88.6%
distribute-neg-frac88.6%
associate-/r/88.6%
fma-def88.6%
sub-neg88.6%
Simplified88.7%
Taylor expanded in v around inf 86.4%
associate--l+86.4%
associate-*r/86.4%
metadata-eval86.4%
unpow286.4%
*-commutative86.4%
unpow286.4%
unpow286.4%
Simplified86.4%
if 1.8e12 < r Initial program 87.1%
sub-neg87.1%
+-commutative87.1%
associate--l+87.2%
associate-/l*94.4%
distribute-neg-frac94.4%
associate-/r/94.4%
fma-def94.4%
sub-neg94.4%
Simplified79.4%
Taylor expanded in v around 0 70.8%
associate--l+70.8%
associate-*r/70.8%
metadata-eval70.8%
unpow270.8%
*-commutative70.8%
unpow270.8%
unpow270.8%
Simplified70.8%
Final simplification71.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r)))))
(if (<= v -11000.0)
(+ -4.5 (- t_0 (* 0.25 (* w (* w (* r r))))))
(+ -4.5 (- t_0 (* 0.375 (* (* r w) (* r w))))))))
double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (v <= -11000.0) {
tmp = -4.5 + (t_0 - (0.25 * (w * (w * (r * r)))));
} else {
tmp = -4.5 + (t_0 - (0.375 * ((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 = 3.0d0 + (2.0d0 / (r * r))
if (v <= (-11000.0d0)) then
tmp = (-4.5d0) + (t_0 - (0.25d0 * (w * (w * (r * r)))))
else
tmp = (-4.5d0) + (t_0 - (0.375d0 * ((r * w) * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (v <= -11000.0) {
tmp = -4.5 + (t_0 - (0.25 * (w * (w * (r * r)))));
} else {
tmp = -4.5 + (t_0 - (0.375 * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 3.0 + (2.0 / (r * r)) tmp = 0 if v <= -11000.0: tmp = -4.5 + (t_0 - (0.25 * (w * (w * (r * r))))) else: tmp = -4.5 + (t_0 - (0.375 * ((r * w) * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if (v <= -11000.0) tmp = Float64(-4.5 + Float64(t_0 - Float64(0.25 * Float64(w * Float64(w * Float64(r * r)))))); else tmp = Float64(-4.5 + Float64(t_0 - Float64(0.375 * Float64(Float64(r * w) * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if (v <= -11000.0) tmp = -4.5 + (t_0 - (0.25 * (w * (w * (r * r))))); else tmp = -4.5 + (t_0 - (0.375 * ((r * w) * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -11000.0], N[(-4.5 + N[(t$95$0 - N[(0.25 * N[(w * N[(w * N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(t$95$0 - N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -11000:\\
\;\;\;\;-4.5 + \left(t_0 - 0.25 \cdot \left(w \cdot \left(w \cdot \left(r \cdot r\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(t_0 - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if v < -11000Initial program 76.8%
sub-neg76.8%
associate-/l*87.3%
cancel-sign-sub-inv87.3%
metadata-eval87.3%
*-commutative87.3%
*-commutative87.3%
metadata-eval87.3%
Simplified87.3%
clear-num87.3%
inv-pow87.3%
associate-*r*82.6%
unswap-sqr99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in r around 0 82.6%
unpow282.6%
*-commutative82.6%
unpow282.6%
swap-sqr99.7%
unpow299.7%
remove-double-div99.7%
associate-/r/99.7%
metadata-eval99.7%
associate-*l/99.7%
unpow299.7%
associate-/r*99.9%
*-rgt-identity99.9%
associate-*r/99.7%
unpow-199.7%
unpow-199.7%
pow-sqr99.8%
metadata-eval99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
*-commutative99.8%
metadata-eval99.8%
pow-div99.9%
inv-pow99.9%
pow199.9%
*-commutative99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in v around inf 82.0%
*-commutative82.0%
unpow282.0%
associate-*r*93.1%
unpow293.1%
Simplified93.1%
if -11000 < v Initial program 85.3%
sub-neg85.3%
associate-/l*87.1%
cancel-sign-sub-inv87.1%
metadata-eval87.1%
*-commutative87.1%
*-commutative87.1%
metadata-eval87.1%
Simplified87.1%
Taylor expanded in v around 0 77.7%
*-commutative77.7%
*-commutative77.7%
unpow277.7%
unpow277.7%
swap-sqr95.3%
unpow295.3%
*-commutative95.3%
Simplified95.3%
unpow295.3%
Applied egg-rr95.3%
Final simplification94.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 4.2e-128)
(+ -1.5 t_0)
(+ t_0 (- (* -0.375 (* (* r r) (* w w))) 1.5)))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 4.2e-128) {
tmp = -1.5 + t_0;
} else {
tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 4.2d-128) then
tmp = (-1.5d0) + t_0
else
tmp = t_0 + (((-0.375d0) * ((r * r) * (w * w))) - 1.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 4.2e-128) {
tmp = -1.5 + t_0;
} else {
tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 4.2e-128: tmp = -1.5 + t_0 else: tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 4.2e-128) tmp = Float64(-1.5 + t_0); else tmp = Float64(t_0 + Float64(Float64(-0.375 * Float64(Float64(r * r) * Float64(w * w))) - 1.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 4.2e-128) tmp = -1.5 + t_0; else tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 4.2e-128], N[(-1.5 + t$95$0), $MachinePrecision], N[(t$95$0 + N[(N[(-0.375 * N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 4.2 \cdot 10^{-128}:\\
\;\;\;\;-1.5 + t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-0.375 \cdot \left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) - 1.5\right)\\
\end{array}
\end{array}
if r < 4.2000000000000002e-128Initial program 82.9%
sub-neg82.9%
+-commutative82.9%
associate--l+82.9%
associate-/l*84.1%
distribute-neg-frac84.1%
associate-/r/84.1%
fma-def84.1%
sub-neg84.1%
Simplified80.0%
Taylor expanded in r around 0 68.8%
sub-neg68.8%
associate-*r/68.8%
metadata-eval68.8%
unpow268.8%
metadata-eval68.8%
Simplified68.8%
if 4.2000000000000002e-128 < r Initial program 83.7%
sub-neg83.7%
+-commutative83.7%
associate--l+83.7%
associate-/l*92.4%
distribute-neg-frac92.4%
associate-/r/92.4%
fma-def92.3%
sub-neg92.3%
Simplified82.7%
Taylor expanded in v around 0 72.6%
associate--l+72.6%
associate-*r/72.6%
metadata-eval72.6%
unpow272.6%
*-commutative72.6%
unpow272.6%
unpow272.6%
Simplified72.6%
Final simplification70.2%
(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.2%
sub-neg83.2%
+-commutative83.2%
associate--l+83.2%
associate-/l*87.2%
distribute-neg-frac87.2%
associate-/r/87.2%
fma-def87.2%
sub-neg87.2%
Simplified81.0%
Taylor expanded in r around 0 56.3%
sub-neg56.3%
associate-*r/56.3%
metadata-eval56.3%
unpow256.3%
metadata-eval56.3%
Simplified56.3%
Final simplification56.3%
herbie shell --seed 2023224
(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))