
(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
(+
(+
3.0
(-
(/ 2.0 (* r r))
(/
(* 0.125 (+ 3.0 (* -2.0 v)))
(* (/ 1.0 (* r w)) (/ (- 1.0 v) (* r w))))))
-4.5))
double code(double v, double w, double r) {
return (3.0 + ((2.0 / (r * r)) - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) * ((1.0 - v) / (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 + ((-2.0d0) * v))) / ((1.0d0 / (r * w)) * ((1.0d0 - v) / (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 + (-2.0 * v))) / ((1.0 / (r * w)) * ((1.0 - v) / (r * w)))))) + -4.5;
}
def code(v, w, r): return (3.0 + ((2.0 / (r * r)) - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) * ((1.0 - v) / (r * w)))))) + -4.5
function code(v, w, r) return Float64(Float64(3.0 + Float64(Float64(2.0 / Float64(r * r)) - Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) / Float64(Float64(1.0 / Float64(r * w)) * Float64(Float64(1.0 - v) / Float64(r * w)))))) + -4.5) end
function tmp = code(v, w, r) tmp = (3.0 + ((2.0 / (r * r)) - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) * ((1.0 - v) / (r * w)))))) + -4.5; end
code[v_, w_, r_] := N[(N[(3.0 + N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \left(\frac{2}{r \cdot r} - \frac{0.125 \cdot \left(3 + -2 \cdot v\right)}{\frac{1}{r \cdot w} \cdot \frac{1 - v}{r \cdot w}}\right)\right) + -4.5
\end{array}
Initial program 83.4%
Simplified85.4%
associate-*r*97.2%
*-commutative97.2%
*-un-lft-identity97.2%
associate-*r*99.8%
times-frac99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (* 0.125 (+ 3.0 (* -2.0 v)))))
(if (or (<= v -26500000.0) (not (<= v 0.0073)))
(+ -4.5 (+ 3.0 (- t_0 (/ t_1 (/ (/ (- v) (* r w)) (* r w))))))
(+ -4.5 (+ 3.0 (- t_0 (/ t_1 (* (/ 1.0 (* r w)) (/ (/ 1.0 r) w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = 0.125 * (3.0 + (-2.0 * v));
double tmp;
if ((v <= -26500000.0) || !(v <= 0.0073)) {
tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((-v / (r * w)) / (r * w)))));
} else {
tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((1.0 / (r * w)) * ((1.0 / 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) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = 0.125d0 * (3.0d0 + ((-2.0d0) * v))
if ((v <= (-26500000.0d0)) .or. (.not. (v <= 0.0073d0))) then
tmp = (-4.5d0) + (3.0d0 + (t_0 - (t_1 / ((-v / (r * w)) / (r * w)))))
else
tmp = (-4.5d0) + (3.0d0 + (t_0 - (t_1 / ((1.0d0 / (r * w)) * ((1.0d0 / r) / w)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = 0.125 * (3.0 + (-2.0 * v));
double tmp;
if ((v <= -26500000.0) || !(v <= 0.0073)) {
tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((-v / (r * w)) / (r * w)))));
} else {
tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((1.0 / (r * w)) * ((1.0 / r) / w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = 0.125 * (3.0 + (-2.0 * v)) tmp = 0 if (v <= -26500000.0) or not (v <= 0.0073): tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((-v / (r * w)) / (r * w))))) else: tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((1.0 / (r * w)) * ((1.0 / r) / w))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) tmp = 0.0 if ((v <= -26500000.0) || !(v <= 0.0073)) tmp = Float64(-4.5 + Float64(3.0 + Float64(t_0 - Float64(t_1 / Float64(Float64(Float64(-v) / Float64(r * w)) / Float64(r * w)))))); else tmp = Float64(-4.5 + Float64(3.0 + Float64(t_0 - Float64(t_1 / Float64(Float64(1.0 / Float64(r * w)) * Float64(Float64(1.0 / r) / w)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = 0.125 * (3.0 + (-2.0 * v)); tmp = 0.0; if ((v <= -26500000.0) || ~((v <= 0.0073))) tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((-v / (r * w)) / (r * w))))); else tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((1.0 / (r * w)) * ((1.0 / r) / w))))); 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[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -26500000.0], N[Not[LessEqual[v, 0.0073]], $MachinePrecision]], N[(-4.5 + N[(3.0 + N[(t$95$0 - N[(t$95$1 / N[(N[((-v) / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(3.0 + N[(t$95$0 - N[(t$95$1 / N[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / r), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := 0.125 \cdot \left(3 + -2 \cdot v\right)\\
\mathbf{if}\;v \leq -26500000 \lor \neg \left(v \leq 0.0073\right):\\
\;\;\;\;-4.5 + \left(3 + \left(t_0 - \frac{t_1}{\frac{\frac{-v}{r \cdot w}}{r \cdot w}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(3 + \left(t_0 - \frac{t_1}{\frac{1}{r \cdot w} \cdot \frac{\frac{1}{r}}{w}}\right)\right)\\
\end{array}
\end{array}
if v < -2.65e7 or 0.00730000000000000007 < v Initial program 79.9%
Simplified84.2%
associate-*r*98.1%
*-commutative98.1%
*-un-lft-identity98.1%
associate-*r*99.7%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 99.8%
neg-mul-199.8%
distribute-neg-frac99.8%
Simplified99.8%
if -2.65e7 < v < 0.00730000000000000007Initial program 86.4%
Simplified86.5%
associate-*r*96.4%
*-commutative96.4%
*-un-lft-identity96.4%
associate-*r*99.8%
times-frac99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.6%
associate-/r*99.6%
Simplified99.6%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (* 0.125 (+ 3.0 (* -2.0 v)))))
(if (or (<= v -28000000.0) (not (<= v 0.0073)))
(+ -4.5 (+ 3.0 (- t_0 (/ t_1 (/ (/ (- v) (* r w)) (* r w))))))
(+ -4.5 (+ 3.0 (- t_0 (/ t_1 (/ (/ 1.0 (* r w)) (* r w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = 0.125 * (3.0 + (-2.0 * v));
double tmp;
if ((v <= -28000000.0) || !(v <= 0.0073)) {
tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((-v / (r * w)) / (r * w)))));
} else {
tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((1.0 / (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) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = 0.125d0 * (3.0d0 + ((-2.0d0) * v))
if ((v <= (-28000000.0d0)) .or. (.not. (v <= 0.0073d0))) then
tmp = (-4.5d0) + (3.0d0 + (t_0 - (t_1 / ((-v / (r * w)) / (r * w)))))
else
tmp = (-4.5d0) + (3.0d0 + (t_0 - (t_1 / ((1.0d0 / (r * w)) / (r * w)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = 0.125 * (3.0 + (-2.0 * v));
double tmp;
if ((v <= -28000000.0) || !(v <= 0.0073)) {
tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((-v / (r * w)) / (r * w)))));
} else {
tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((1.0 / (r * w)) / (r * w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = 0.125 * (3.0 + (-2.0 * v)) tmp = 0 if (v <= -28000000.0) or not (v <= 0.0073): tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((-v / (r * w)) / (r * w))))) else: tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((1.0 / (r * w)) / (r * w))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) tmp = 0.0 if ((v <= -28000000.0) || !(v <= 0.0073)) tmp = Float64(-4.5 + Float64(3.0 + Float64(t_0 - Float64(t_1 / Float64(Float64(Float64(-v) / Float64(r * w)) / Float64(r * w)))))); else tmp = Float64(-4.5 + Float64(3.0 + Float64(t_0 - Float64(t_1 / Float64(Float64(1.0 / Float64(r * w)) / Float64(r * w)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = 0.125 * (3.0 + (-2.0 * v)); tmp = 0.0; if ((v <= -28000000.0) || ~((v <= 0.0073))) tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((-v / (r * w)) / (r * w))))); else tmp = -4.5 + (3.0 + (t_0 - (t_1 / ((1.0 / (r * w)) / (r * w))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -28000000.0], N[Not[LessEqual[v, 0.0073]], $MachinePrecision]], N[(-4.5 + N[(3.0 + N[(t$95$0 - N[(t$95$1 / N[(N[((-v) / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(3.0 + N[(t$95$0 - N[(t$95$1 / N[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := 0.125 \cdot \left(3 + -2 \cdot v\right)\\
\mathbf{if}\;v \leq -28000000 \lor \neg \left(v \leq 0.0073\right):\\
\;\;\;\;-4.5 + \left(3 + \left(t_0 - \frac{t_1}{\frac{\frac{-v}{r \cdot w}}{r \cdot w}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(3 + \left(t_0 - \frac{t_1}{\frac{\frac{1}{r \cdot w}}{r \cdot w}}\right)\right)\\
\end{array}
\end{array}
if v < -2.8e7 or 0.00730000000000000007 < v Initial program 79.9%
Simplified84.2%
associate-*r*98.1%
*-commutative98.1%
*-un-lft-identity98.1%
associate-*r*99.7%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 99.8%
neg-mul-199.8%
distribute-neg-frac99.8%
Simplified99.8%
if -2.8e7 < v < 0.00730000000000000007Initial program 86.4%
Simplified86.5%
associate-*r*96.4%
*-commutative96.4%
*-un-lft-identity96.4%
associate-*r*99.8%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.6%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* 0.125 (+ 3.0 (* -2.0 v)))) (t_1 (/ 2.0 (* r r))))
(if (<= r 2.1e-126)
(+ -4.5 (+ 3.0 (- t_1 (/ t_0 (/ (/ 1.0 (* r w)) (* r w))))))
(+ -4.5 (+ 3.0 (- t_1 (/ t_0 (/ (/ (- 1.0 v) r) (* w (* r w))))))))))
double code(double v, double w, double r) {
double t_0 = 0.125 * (3.0 + (-2.0 * v));
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 2.1e-126) {
tmp = -4.5 + (3.0 + (t_1 - (t_0 / ((1.0 / (r * w)) / (r * w)))));
} else {
tmp = -4.5 + (3.0 + (t_1 - (t_0 / (((1.0 - v) / r) / (w * (r * w))))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.125d0 * (3.0d0 + ((-2.0d0) * v))
t_1 = 2.0d0 / (r * r)
if (r <= 2.1d-126) then
tmp = (-4.5d0) + (3.0d0 + (t_1 - (t_0 / ((1.0d0 / (r * w)) / (r * w)))))
else
tmp = (-4.5d0) + (3.0d0 + (t_1 - (t_0 / (((1.0d0 - v) / r) / (w * (r * w))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 0.125 * (3.0 + (-2.0 * v));
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 2.1e-126) {
tmp = -4.5 + (3.0 + (t_1 - (t_0 / ((1.0 / (r * w)) / (r * w)))));
} else {
tmp = -4.5 + (3.0 + (t_1 - (t_0 / (((1.0 - v) / r) / (w * (r * w))))));
}
return tmp;
}
def code(v, w, r): t_0 = 0.125 * (3.0 + (-2.0 * v)) t_1 = 2.0 / (r * r) tmp = 0 if r <= 2.1e-126: tmp = -4.5 + (3.0 + (t_1 - (t_0 / ((1.0 / (r * w)) / (r * w))))) else: tmp = -4.5 + (3.0 + (t_1 - (t_0 / (((1.0 - v) / r) / (w * (r * w)))))) return tmp
function code(v, w, r) t_0 = Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 2.1e-126) tmp = Float64(-4.5 + Float64(3.0 + Float64(t_1 - Float64(t_0 / Float64(Float64(1.0 / Float64(r * w)) / Float64(r * w)))))); else tmp = Float64(-4.5 + Float64(3.0 + Float64(t_1 - Float64(t_0 / Float64(Float64(Float64(1.0 - v) / r) / Float64(w * Float64(r * w))))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 0.125 * (3.0 + (-2.0 * v)); t_1 = 2.0 / (r * r); tmp = 0.0; if (r <= 2.1e-126) tmp = -4.5 + (3.0 + (t_1 - (t_0 / ((1.0 / (r * w)) / (r * w))))); else tmp = -4.5 + (3.0 + (t_1 - (t_0 / (((1.0 - v) / r) / (w * (r * w)))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 2.1e-126], N[(-4.5 + N[(3.0 + N[(t$95$1 - N[(t$95$0 / N[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(3.0 + N[(t$95$1 - N[(t$95$0 / N[(N[(N[(1.0 - v), $MachinePrecision] / r), $MachinePrecision] / N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(3 + -2 \cdot v\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 2.1 \cdot 10^{-126}:\\
\;\;\;\;-4.5 + \left(3 + \left(t_1 - \frac{t_0}{\frac{\frac{1}{r \cdot w}}{r \cdot w}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(3 + \left(t_1 - \frac{t_0}{\frac{\frac{1 - v}{r}}{w \cdot \left(r \cdot w\right)}}\right)\right)\\
\end{array}
\end{array}
if r < 2.0999999999999999e-126Initial program 83.4%
Simplified85.6%
associate-*r*95.9%
*-commutative95.9%
*-un-lft-identity95.9%
associate-*r*99.8%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 87.0%
if 2.0999999999999999e-126 < r Initial program 83.5%
Simplified85.0%
associate-*r*99.8%
*-commutative99.8%
*-un-lft-identity99.8%
associate-*r*99.7%
times-frac99.8%
Applied egg-rr99.8%
associate-/r*98.7%
frac-times98.6%
metadata-eval98.6%
times-frac98.6%
*-un-lft-identity98.6%
*-un-lft-identity98.6%
Applied egg-rr98.6%
Final simplification90.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 1.65e-92)
(+
-4.5
(+
3.0
(- t_0 (/ (* 0.125 (+ 3.0 (* -2.0 v))) (/ (/ 1.0 (* r w)) (* r w))))))
(+
(+ t_0 (* (/ (+ -0.375 (* v 0.25)) (- 1.0 v)) (* 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 <= 1.65e-92) {
tmp = -4.5 + (3.0 + (t_0 - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) / (r * w)))));
} else {
tmp = (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (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 <= 1.65d-92) then
tmp = (-4.5d0) + (3.0d0 + (t_0 - ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) / ((1.0d0 / (r * w)) / (r * w)))))
else
tmp = (t_0 + ((((-0.375d0) + (v * 0.25d0)) / (1.0d0 - v)) * (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 <= 1.65e-92) {
tmp = -4.5 + (3.0 + (t_0 - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) / (r * w)))));
} else {
tmp = (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (r * (r * (w * w))))) + -1.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 1.65e-92: tmp = -4.5 + (3.0 + (t_0 - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) / (r * w))))) else: tmp = (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (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 <= 1.65e-92) tmp = Float64(-4.5 + Float64(3.0 + Float64(t_0 - Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) / Float64(Float64(1.0 / Float64(r * w)) / Float64(r * w)))))); else tmp = Float64(Float64(t_0 + Float64(Float64(Float64(-0.375 + Float64(v * 0.25)) / Float64(1.0 - v)) * Float64(r * Float64(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 <= 1.65e-92) tmp = -4.5 + (3.0 + (t_0 - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) / (r * w))))); else tmp = (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (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, 1.65e-92], N[(-4.5 + N[(3.0 + N[(t$95$0 - N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 + 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] + -1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 1.65 \cdot 10^{-92}:\\
\;\;\;\;-4.5 + \left(3 + \left(t_0 - \frac{0.125 \cdot \left(3 + -2 \cdot v\right)}{\frac{\frac{1}{r \cdot w}}{r \cdot w}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 + \frac{-0.375 + v \cdot 0.25}{1 - v} \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right) + -1.5\\
\end{array}
\end{array}
if r < 1.64999999999999999e-92Initial program 83.7%
Simplified85.8%
associate-*r*96.1%
*-commutative96.1%
*-un-lft-identity96.1%
associate-*r*99.8%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 87.2%
if 1.64999999999999999e-92 < r Initial program 82.8%
Simplified84.5%
Final simplification86.4%
(FPCore (v w r)
:precision binary64
(+
-4.5
(+
3.0
(-
(/ 2.0 (* r r))
(/ (* 0.125 (+ 3.0 (* -2.0 v))) (/ (/ (- 1.0 v) (* 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 + (-2.0 * v))) / (((1.0 - v) / (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 + ((-2.0d0) * v))) / (((1.0d0 - v) / (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 + (-2.0 * v))) / (((1.0 - v) / (r * w)) / (r * w)))));
}
def code(v, w, r): return -4.5 + (3.0 + ((2.0 / (r * r)) - ((0.125 * (3.0 + (-2.0 * v))) / (((1.0 - v) / (r * w)) / (r * w)))))
function code(v, w, r) return Float64(-4.5 + Float64(3.0 + Float64(Float64(2.0 / Float64(r * r)) - Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) / Float64(Float64(Float64(1.0 - v) / 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 + (-2.0 * v))) / (((1.0 - v) / (r * w)) / (r * w))))); end
code[v_, w_, r_] := N[(-4.5 + N[(3.0 + N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4.5 + \left(3 + \left(\frac{2}{r \cdot r} - \frac{0.125 \cdot \left(3 + -2 \cdot v\right)}{\frac{\frac{1 - v}{r \cdot w}}{r \cdot w}}\right)\right)
\end{array}
Initial program 83.4%
Simplified85.4%
associate-*r*97.2%
*-commutative97.2%
*-un-lft-identity97.2%
associate-*r*99.8%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* r (* r (* w w)))))
(if (<= r 5.5e-88)
(+ -1.5 (+ (* 2.0 (/ (/ 1.0 r) r)) (* t_0 (+ (/ 0.125 v) -0.25))))
(+
(+ (/ 2.0 (* r r)) (* (/ (+ -0.375 (* v 0.25)) (- 1.0 v)) t_0))
-1.5))))
double code(double v, double w, double r) {
double t_0 = r * (r * (w * w));
double tmp;
if (r <= 5.5e-88) {
tmp = -1.5 + ((2.0 * ((1.0 / r) / r)) + (t_0 * ((0.125 / v) + -0.25)));
} else {
tmp = ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * 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) :: tmp
t_0 = r * (r * (w * w))
if (r <= 5.5d-88) then
tmp = (-1.5d0) + ((2.0d0 * ((1.0d0 / r) / r)) + (t_0 * ((0.125d0 / v) + (-0.25d0))))
else
tmp = ((2.0d0 / (r * r)) + ((((-0.375d0) + (v * 0.25d0)) / (1.0d0 - v)) * 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 tmp;
if (r <= 5.5e-88) {
tmp = -1.5 + ((2.0 * ((1.0 / r) / r)) + (t_0 * ((0.125 / v) + -0.25)));
} else {
tmp = ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * t_0)) + -1.5;
}
return tmp;
}
def code(v, w, r): t_0 = r * (r * (w * w)) tmp = 0 if r <= 5.5e-88: tmp = -1.5 + ((2.0 * ((1.0 / r) / r)) + (t_0 * ((0.125 / v) + -0.25))) else: tmp = ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * t_0)) + -1.5 return tmp
function code(v, w, r) t_0 = Float64(r * Float64(r * Float64(w * w))) tmp = 0.0 if (r <= 5.5e-88) tmp = Float64(-1.5 + Float64(Float64(2.0 * Float64(Float64(1.0 / r) / r)) + Float64(t_0 * Float64(Float64(0.125 / v) + -0.25)))); else tmp = Float64(Float64(Float64(2.0 / Float64(r * r)) + Float64(Float64(Float64(-0.375 + Float64(v * 0.25)) / Float64(1.0 - v)) * t_0)) + -1.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r * (r * (w * w)); tmp = 0.0; if (r <= 5.5e-88) tmp = -1.5 + ((2.0 * ((1.0 / r) / r)) + (t_0 * ((0.125 / v) + -0.25))); else tmp = ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * t_0)) + -1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 5.5e-88], N[(-1.5 + N[(N[(2.0 * N[(N[(1.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(N[(0.125 / v), $MachinePrecision] + -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-0.375 + N[(v * 0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := r \cdot \left(r \cdot \left(w \cdot w\right)\right)\\
\mathbf{if}\;r \leq 5.5 \cdot 10^{-88}:\\
\;\;\;\;-1.5 + \left(2 \cdot \frac{\frac{1}{r}}{r} + t_0 \cdot \left(\frac{0.125}{v} + -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{2}{r \cdot r} + \frac{-0.375 + v \cdot 0.25}{1 - v} \cdot t_0\right) + -1.5\\
\end{array}
\end{array}
if r < 5.49999999999999971e-88Initial program 83.8%
Simplified85.8%
associate-/r*85.8%
div-inv85.8%
*-un-lft-identity85.8%
times-frac85.8%
metadata-eval85.8%
Applied egg-rr85.8%
Taylor expanded in v around inf 79.3%
sub-neg79.3%
associate-*r/79.3%
metadata-eval79.3%
metadata-eval79.3%
Simplified79.3%
if 5.49999999999999971e-88 < r Initial program 82.6%
Simplified84.3%
Final simplification80.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* r (* r (* w w)))) (t_1 (* 2.0 (/ (/ 1.0 r) r))))
(if (<= r 3.2e-100)
(+ -1.5 (+ t_1 (* t_0 (+ (/ 0.125 v) -0.25))))
(+ -1.5 (+ t_1 (* -0.375 t_0))))))
double code(double v, double w, double r) {
double t_0 = r * (r * (w * w));
double t_1 = 2.0 * ((1.0 / r) / r);
double tmp;
if (r <= 3.2e-100) {
tmp = -1.5 + (t_1 + (t_0 * ((0.125 / v) + -0.25)));
} else {
tmp = -1.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 = r * (r * (w * w))
t_1 = 2.0d0 * ((1.0d0 / r) / r)
if (r <= 3.2d-100) then
tmp = (-1.5d0) + (t_1 + (t_0 * ((0.125d0 / v) + (-0.25d0))))
else
tmp = (-1.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 = r * (r * (w * w));
double t_1 = 2.0 * ((1.0 / r) / r);
double tmp;
if (r <= 3.2e-100) {
tmp = -1.5 + (t_1 + (t_0 * ((0.125 / v) + -0.25)));
} else {
tmp = -1.5 + (t_1 + (-0.375 * t_0));
}
return tmp;
}
def code(v, w, r): t_0 = r * (r * (w * w)) t_1 = 2.0 * ((1.0 / r) / r) tmp = 0 if r <= 3.2e-100: tmp = -1.5 + (t_1 + (t_0 * ((0.125 / v) + -0.25))) else: tmp = -1.5 + (t_1 + (-0.375 * t_0)) return tmp
function code(v, w, r) t_0 = Float64(r * Float64(r * Float64(w * w))) t_1 = Float64(2.0 * Float64(Float64(1.0 / r) / r)) tmp = 0.0 if (r <= 3.2e-100) tmp = Float64(-1.5 + Float64(t_1 + Float64(t_0 * Float64(Float64(0.125 / v) + -0.25)))); else tmp = Float64(-1.5 + Float64(t_1 + Float64(-0.375 * t_0))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r * (r * (w * w)); t_1 = 2.0 * ((1.0 / r) / r); tmp = 0.0; if (r <= 3.2e-100) tmp = -1.5 + (t_1 + (t_0 * ((0.125 / v) + -0.25))); else tmp = -1.5 + (t_1 + (-0.375 * t_0)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(N[(1.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 3.2e-100], N[(-1.5 + N[(t$95$1 + N[(t$95$0 * N[(N[(0.125 / v), $MachinePrecision] + -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.5 + N[(t$95$1 + N[(-0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := r \cdot \left(r \cdot \left(w \cdot w\right)\right)\\
t_1 := 2 \cdot \frac{\frac{1}{r}}{r}\\
\mathbf{if}\;r \leq 3.2 \cdot 10^{-100}:\\
\;\;\;\;-1.5 + \left(t_1 + t_0 \cdot \left(\frac{0.125}{v} + -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \left(t_1 + -0.375 \cdot t_0\right)\\
\end{array}
\end{array}
if r < 3.20000000000000017e-100Initial program 83.9%
Simplified86.1%
associate-/r*86.1%
div-inv86.1%
*-un-lft-identity86.1%
times-frac86.1%
metadata-eval86.1%
Applied egg-rr86.1%
Taylor expanded in v around inf 79.4%
sub-neg79.4%
associate-*r/79.4%
metadata-eval79.4%
metadata-eval79.4%
Simplified79.4%
if 3.20000000000000017e-100 < r Initial program 82.3%
Simplified83.9%
associate-/r*83.9%
div-inv83.9%
*-un-lft-identity83.9%
times-frac83.9%
metadata-eval83.9%
Applied egg-rr83.9%
Taylor expanded in v around 0 81.7%
Final simplification80.1%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* r (* r (* w w)))) (t_1 (* 2.0 (/ (/ 1.0 r) r))))
(if (<= v -4e+23)
(+ -1.5 (+ t_1 (* t_0 -0.25)))
(+ -1.5 (+ t_1 (* -0.375 t_0))))))
double code(double v, double w, double r) {
double t_0 = r * (r * (w * w));
double t_1 = 2.0 * ((1.0 / r) / r);
double tmp;
if (v <= -4e+23) {
tmp = -1.5 + (t_1 + (t_0 * -0.25));
} else {
tmp = -1.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 = r * (r * (w * w))
t_1 = 2.0d0 * ((1.0d0 / r) / r)
if (v <= (-4d+23)) then
tmp = (-1.5d0) + (t_1 + (t_0 * (-0.25d0)))
else
tmp = (-1.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 = r * (r * (w * w));
double t_1 = 2.0 * ((1.0 / r) / r);
double tmp;
if (v <= -4e+23) {
tmp = -1.5 + (t_1 + (t_0 * -0.25));
} else {
tmp = -1.5 + (t_1 + (-0.375 * t_0));
}
return tmp;
}
def code(v, w, r): t_0 = r * (r * (w * w)) t_1 = 2.0 * ((1.0 / r) / r) tmp = 0 if v <= -4e+23: tmp = -1.5 + (t_1 + (t_0 * -0.25)) else: tmp = -1.5 + (t_1 + (-0.375 * t_0)) return tmp
function code(v, w, r) t_0 = Float64(r * Float64(r * Float64(w * w))) t_1 = Float64(2.0 * Float64(Float64(1.0 / r) / r)) tmp = 0.0 if (v <= -4e+23) tmp = Float64(-1.5 + Float64(t_1 + Float64(t_0 * -0.25))); else tmp = Float64(-1.5 + Float64(t_1 + Float64(-0.375 * t_0))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r * (r * (w * w)); t_1 = 2.0 * ((1.0 / r) / r); tmp = 0.0; if (v <= -4e+23) tmp = -1.5 + (t_1 + (t_0 * -0.25)); else tmp = -1.5 + (t_1 + (-0.375 * t_0)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(N[(1.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -4e+23], N[(-1.5 + N[(t$95$1 + N[(t$95$0 * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.5 + N[(t$95$1 + N[(-0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := r \cdot \left(r \cdot \left(w \cdot w\right)\right)\\
t_1 := 2 \cdot \frac{\frac{1}{r}}{r}\\
\mathbf{if}\;v \leq -4 \cdot 10^{+23}:\\
\;\;\;\;-1.5 + \left(t_1 + t_0 \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \left(t_1 + -0.375 \cdot t_0\right)\\
\end{array}
\end{array}
if v < -3.9999999999999997e23Initial program 76.4%
Simplified84.1%
associate-/r*84.0%
div-inv84.0%
*-un-lft-identity84.0%
times-frac84.0%
metadata-eval84.0%
Applied egg-rr84.0%
Taylor expanded in v around inf 84.0%
if -3.9999999999999997e23 < v Initial program 85.1%
Simplified85.7%
associate-/r*85.7%
div-inv85.7%
*-un-lft-identity85.7%
times-frac85.7%
metadata-eval85.7%
Applied egg-rr85.7%
Taylor expanded in v around 0 84.8%
Final simplification84.7%
(FPCore (v w r) :precision binary64 (+ -1.5 (+ (* 2.0 (/ (/ 1.0 r) r)) (* -0.375 (* r (* r (* w w)))))))
double code(double v, double w, double r) {
return -1.5 + ((2.0 * ((1.0 / r) / r)) + (-0.375 * (r * (r * (w * w)))));
}
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 * ((1.0d0 / r) / r)) + ((-0.375d0) * (r * (r * (w * w)))))
end function
public static double code(double v, double w, double r) {
return -1.5 + ((2.0 * ((1.0 / r) / r)) + (-0.375 * (r * (r * (w * w)))));
}
def code(v, w, r): return -1.5 + ((2.0 * ((1.0 / r) / r)) + (-0.375 * (r * (r * (w * w)))))
function code(v, w, r) return Float64(-1.5 + Float64(Float64(2.0 * Float64(Float64(1.0 / r) / r)) + Float64(-0.375 * Float64(r * Float64(r * Float64(w * w)))))) end
function tmp = code(v, w, r) tmp = -1.5 + ((2.0 * ((1.0 / r) / r)) + (-0.375 * (r * (r * (w * w))))); end
code[v_, w_, r_] := N[(-1.5 + N[(N[(2.0 * N[(N[(1.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 + \left(2 \cdot \frac{\frac{1}{r}}{r} + -0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)
\end{array}
Initial program 83.4%
Simplified85.4%
associate-/r*85.4%
div-inv85.4%
*-un-lft-identity85.4%
times-frac85.4%
metadata-eval85.4%
Applied egg-rr85.4%
Taylor expanded in v around 0 82.5%
Final simplification82.5%
herbie shell --seed 2023334
(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))