
(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
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= (* w w) 0.0)
(+ t_0 (+ -1.5 (* r (* w (* (* r w) -0.375)))))
(if (<= (* w w) 2e+233)
(+
t_0
(- -1.5 (* (/ (+ 0.375 (* v -0.25)) (- 1.0 v)) (* r (* r (* w w))))))
(+ t_0 (- -1.5 (* 0.375 (* w (* (* r r) w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 0.0) {
tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375))));
} else if ((w * w) <= 2e+233) {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
} else {
tmp = t_0 + (-1.5 - (0.375 * (w * ((r * r) * w))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((w * w) <= 0.0d0) then
tmp = t_0 + ((-1.5d0) + (r * (w * ((r * w) * (-0.375d0)))))
else if ((w * w) <= 2d+233) then
tmp = t_0 + ((-1.5d0) - (((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)) * (r * (r * (w * w)))))
else
tmp = t_0 + ((-1.5d0) - (0.375d0 * (w * ((r * r) * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 0.0) {
tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375))));
} else if ((w * w) <= 2e+233) {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
} else {
tmp = t_0 + (-1.5 - (0.375 * (w * ((r * r) * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (w * w) <= 0.0: tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375)))) elif (w * w) <= 2e+233: tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))) else: tmp = t_0 + (-1.5 - (0.375 * (w * ((r * r) * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(w * w) <= 0.0) tmp = Float64(t_0 + Float64(-1.5 + Float64(r * Float64(w * Float64(Float64(r * w) * -0.375))))); elseif (Float64(w * w) <= 2e+233) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v)) * Float64(r * Float64(r * Float64(w * w)))))); else tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * Float64(w * Float64(Float64(r * r) * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((w * w) <= 0.0) tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375)))); elseif ((w * w) <= 2e+233) tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))); else tmp = t_0 + (-1.5 - (0.375 * (w * ((r * r) * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(w * w), $MachinePrecision], 0.0], N[(t$95$0 + N[(-1.5 + N[(r * N[(w * N[(N[(r * w), $MachinePrecision] * -0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(w * w), $MachinePrecision], 2e+233], N[(t$95$0 + N[(-1.5 - N[(N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(0.375 * N[(w * N[(N[(r * r), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \cdot w \leq 0:\\
\;\;\;\;t_0 + \left(-1.5 + r \cdot \left(w \cdot \left(\left(r \cdot w\right) \cdot -0.375\right)\right)\right)\\
\mathbf{elif}\;w \cdot w \leq 2 \cdot 10^{+233}:\\
\;\;\;\;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 + \left(-1.5 - 0.375 \cdot \left(w \cdot \left(\left(r \cdot r\right) \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 0.0Initial program 88.8%
sub-neg88.8%
+-commutative88.8%
associate--l+88.8%
associate-/l*88.8%
distribute-neg-frac88.8%
associate-/r/88.8%
fma-def88.8%
sub-neg88.8%
Simplified82.2%
Taylor expanded in v around 0 82.2%
associate--l+82.2%
associate-*r/82.2%
metadata-eval82.2%
unpow282.2%
*-commutative82.2%
*-commutative82.2%
unpow282.2%
associate-*r*88.9%
unpow288.9%
associate-*l*88.9%
fma-neg88.9%
associate-*r*96.2%
*-commutative96.2%
*-commutative96.2%
metadata-eval96.2%
Simplified96.2%
fma-udef96.2%
associate-*l*96.3%
Applied egg-rr96.3%
if 0.0 < (*.f64 w w) < 1.99999999999999995e233Initial program 94.2%
associate--l-94.2%
+-commutative94.2%
associate--l+94.2%
+-commutative94.2%
associate--r+94.2%
metadata-eval94.2%
associate-*l/99.7%
*-commutative99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
if 1.99999999999999995e233 < (*.f64 w w) Initial program 79.6%
associate--l-79.6%
+-commutative79.6%
associate--l+79.6%
+-commutative79.6%
associate--r+79.6%
metadata-eval79.6%
associate-*l/79.6%
*-commutative79.6%
*-commutative79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in r around 0 79.6%
unpow279.6%
associate-*l*92.0%
Simplified92.0%
clear-num92.0%
inv-pow92.0%
+-commutative92.0%
fma-def92.0%
Applied egg-rr92.0%
unpow-192.0%
fma-udef92.0%
*-commutative92.0%
fma-def92.0%
Simplified92.0%
Taylor expanded in v around 0 79.6%
unpow279.6%
associate-*l*97.3%
unpow297.3%
Simplified97.3%
Final simplification98.1%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (* (* r (* w (* r w))) (/ -1.0 (/ (- 1.0 v) (fma -0.25 v 0.375)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((r * (w * (r * w))) * (-1.0 / ((1.0 - v) / fma(-0.25, v, 0.375)))));
}
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(-1.0 / Float64(Float64(1.0 - v) / fma(-0.25, v, 0.375)))))) 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[(-1.0 / N[(N[(1.0 - v), $MachinePrecision] / N[(-0.25 * v + 0.375), $MachinePrecision]), $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{-1}{\frac{1 - v}{\mathsf{fma}\left(-0.25, v, 0.375\right)}}\right)
\end{array}
Initial program 88.7%
associate--l-88.7%
+-commutative88.7%
associate--l+88.7%
+-commutative88.7%
associate--r+88.7%
metadata-eval88.7%
associate-*l/91.2%
*-commutative91.2%
*-commutative91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in r around 0 91.2%
unpow291.2%
associate-*l*97.5%
Simplified97.5%
clear-num97.5%
inv-pow97.5%
+-commutative97.5%
fma-def97.5%
Applied egg-rr97.5%
unpow-197.5%
fma-udef97.5%
*-commutative97.5%
fma-def97.5%
Simplified97.5%
Final simplification97.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* w (* r w))) (t_1 (/ 2.0 (* r r))) (t_2 (* r t_0)))
(if (<= v -2.8e+15)
(- (+ -1.5 (/ (/ 2.0 r) r)) (* r (* t_0 0.25)))
(if (<= v 1e-28)
(+ t_1 (- -1.5 (* t_2 (+ 0.375 (* v 0.125)))))
(+ t_1 (- -1.5 (* t_2 0.25)))))))
double code(double v, double w, double r) {
double t_0 = w * (r * w);
double t_1 = 2.0 / (r * r);
double t_2 = r * t_0;
double tmp;
if (v <= -2.8e+15) {
tmp = (-1.5 + ((2.0 / r) / r)) - (r * (t_0 * 0.25));
} else if (v <= 1e-28) {
tmp = t_1 + (-1.5 - (t_2 * (0.375 + (v * 0.125))));
} else {
tmp = t_1 + (-1.5 - (t_2 * 0.25));
}
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 = w * (r * w)
t_1 = 2.0d0 / (r * r)
t_2 = r * t_0
if (v <= (-2.8d+15)) then
tmp = ((-1.5d0) + ((2.0d0 / r) / r)) - (r * (t_0 * 0.25d0))
else if (v <= 1d-28) then
tmp = t_1 + ((-1.5d0) - (t_2 * (0.375d0 + (v * 0.125d0))))
else
tmp = t_1 + ((-1.5d0) - (t_2 * 0.25d0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = w * (r * w);
double t_1 = 2.0 / (r * r);
double t_2 = r * t_0;
double tmp;
if (v <= -2.8e+15) {
tmp = (-1.5 + ((2.0 / r) / r)) - (r * (t_0 * 0.25));
} else if (v <= 1e-28) {
tmp = t_1 + (-1.5 - (t_2 * (0.375 + (v * 0.125))));
} else {
tmp = t_1 + (-1.5 - (t_2 * 0.25));
}
return tmp;
}
def code(v, w, r): t_0 = w * (r * w) t_1 = 2.0 / (r * r) t_2 = r * t_0 tmp = 0 if v <= -2.8e+15: tmp = (-1.5 + ((2.0 / r) / r)) - (r * (t_0 * 0.25)) elif v <= 1e-28: tmp = t_1 + (-1.5 - (t_2 * (0.375 + (v * 0.125)))) else: tmp = t_1 + (-1.5 - (t_2 * 0.25)) return tmp
function code(v, w, r) t_0 = Float64(w * Float64(r * w)) t_1 = Float64(2.0 / Float64(r * r)) t_2 = Float64(r * t_0) tmp = 0.0 if (v <= -2.8e+15) tmp = Float64(Float64(-1.5 + Float64(Float64(2.0 / r) / r)) - Float64(r * Float64(t_0 * 0.25))); elseif (v <= 1e-28) tmp = Float64(t_1 + Float64(-1.5 - Float64(t_2 * Float64(0.375 + Float64(v * 0.125))))); else tmp = Float64(t_1 + Float64(-1.5 - Float64(t_2 * 0.25))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = w * (r * w); t_1 = 2.0 / (r * r); t_2 = r * t_0; tmp = 0.0; if (v <= -2.8e+15) tmp = (-1.5 + ((2.0 / r) / r)) - (r * (t_0 * 0.25)); elseif (v <= 1e-28) tmp = t_1 + (-1.5 - (t_2 * (0.375 + (v * 0.125)))); else tmp = t_1 + (-1.5 - (t_2 * 0.25)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(r * t$95$0), $MachinePrecision]}, If[LessEqual[v, -2.8e+15], N[(N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - N[(r * N[(t$95$0 * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 1e-28], N[(t$95$1 + N[(-1.5 - N[(t$95$2 * N[(0.375 + N[(v * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 - N[(t$95$2 * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := w \cdot \left(r \cdot w\right)\\
t_1 := \frac{2}{r \cdot r}\\
t_2 := r \cdot t_0\\
\mathbf{if}\;v \leq -2.8 \cdot 10^{+15}:\\
\;\;\;\;\left(-1.5 + \frac{\frac{2}{r}}{r}\right) - r \cdot \left(t_0 \cdot 0.25\right)\\
\mathbf{elif}\;v \leq 10^{-28}:\\
\;\;\;\;t_1 + \left(-1.5 - t_2 \cdot \left(0.375 + v \cdot 0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(-1.5 - t_2 \cdot 0.25\right)\\
\end{array}
\end{array}
if v < -2.8e15Initial program 80.7%
associate--l-80.7%
+-commutative80.7%
associate--l+80.7%
+-commutative80.7%
associate--r+80.7%
metadata-eval80.7%
associate-*l/86.9%
*-commutative86.9%
*-commutative86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in r around 0 86.9%
unpow286.9%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in v around inf 96.8%
associate-+r-96.8%
associate-/r*96.9%
associate-*l*96.9%
*-commutative96.9%
Applied egg-rr96.9%
if -2.8e15 < v < 9.99999999999999971e-29Initial program 91.9%
associate--l-91.9%
+-commutative91.9%
associate--l+92.0%
+-commutative92.0%
associate--r+92.0%
metadata-eval92.0%
associate-*l/92.0%
*-commutative92.0%
*-commutative92.0%
*-commutative92.0%
Simplified92.0%
Taylor expanded in r around 0 92.0%
unpow292.0%
associate-*l*97.3%
Simplified97.3%
Taylor expanded in v around 0 97.3%
if 9.99999999999999971e-29 < v Initial program 89.7%
associate--l-89.7%
+-commutative89.7%
associate--l+89.8%
+-commutative89.8%
associate--r+89.8%
metadata-eval89.8%
associate-*l/93.4%
*-commutative93.4%
*-commutative93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in r around 0 93.4%
unpow293.4%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in v around inf 97.6%
Final simplification97.3%
(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 88.7%
associate--l-88.7%
+-commutative88.7%
associate--l+88.7%
+-commutative88.7%
associate--r+88.7%
metadata-eval88.7%
associate-*l/91.2%
*-commutative91.2%
*-commutative91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in r around 0 91.2%
unpow291.2%
associate-*l*97.5%
Simplified97.5%
Final simplification97.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* w (* r w))) (t_1 (/ 2.0 (* r r))))
(if (<= v -8.2e+30)
(- (+ -1.5 (/ (/ 2.0 r) r)) (* r (* t_0 0.25)))
(if (<= v 2e-31)
(+ t_1 (+ -1.5 (* r (* w (* (* r w) -0.375)))))
(+ t_1 (- -1.5 (* (* r t_0) 0.25)))))))
double code(double v, double w, double r) {
double t_0 = w * (r * w);
double t_1 = 2.0 / (r * r);
double tmp;
if (v <= -8.2e+30) {
tmp = (-1.5 + ((2.0 / r) / r)) - (r * (t_0 * 0.25));
} else if (v <= 2e-31) {
tmp = t_1 + (-1.5 + (r * (w * ((r * w) * -0.375))));
} else {
tmp = t_1 + (-1.5 - ((r * t_0) * 0.25));
}
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 * (r * w)
t_1 = 2.0d0 / (r * r)
if (v <= (-8.2d+30)) then
tmp = ((-1.5d0) + ((2.0d0 / r) / r)) - (r * (t_0 * 0.25d0))
else if (v <= 2d-31) then
tmp = t_1 + ((-1.5d0) + (r * (w * ((r * w) * (-0.375d0)))))
else
tmp = t_1 + ((-1.5d0) - ((r * t_0) * 0.25d0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = w * (r * w);
double t_1 = 2.0 / (r * r);
double tmp;
if (v <= -8.2e+30) {
tmp = (-1.5 + ((2.0 / r) / r)) - (r * (t_0 * 0.25));
} else if (v <= 2e-31) {
tmp = t_1 + (-1.5 + (r * (w * ((r * w) * -0.375))));
} else {
tmp = t_1 + (-1.5 - ((r * t_0) * 0.25));
}
return tmp;
}
def code(v, w, r): t_0 = w * (r * w) t_1 = 2.0 / (r * r) tmp = 0 if v <= -8.2e+30: tmp = (-1.5 + ((2.0 / r) / r)) - (r * (t_0 * 0.25)) elif v <= 2e-31: tmp = t_1 + (-1.5 + (r * (w * ((r * w) * -0.375)))) else: tmp = t_1 + (-1.5 - ((r * t_0) * 0.25)) return tmp
function code(v, w, r) t_0 = Float64(w * Float64(r * w)) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -8.2e+30) tmp = Float64(Float64(-1.5 + Float64(Float64(2.0 / r) / r)) - Float64(r * Float64(t_0 * 0.25))); elseif (v <= 2e-31) tmp = Float64(t_1 + Float64(-1.5 + Float64(r * Float64(w * Float64(Float64(r * w) * -0.375))))); else tmp = Float64(t_1 + Float64(-1.5 - Float64(Float64(r * t_0) * 0.25))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = w * (r * w); t_1 = 2.0 / (r * r); tmp = 0.0; if (v <= -8.2e+30) tmp = (-1.5 + ((2.0 / r) / r)) - (r * (t_0 * 0.25)); elseif (v <= 2e-31) tmp = t_1 + (-1.5 + (r * (w * ((r * w) * -0.375)))); else tmp = t_1 + (-1.5 - ((r * t_0) * 0.25)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -8.2e+30], N[(N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - N[(r * N[(t$95$0 * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 2e-31], N[(t$95$1 + N[(-1.5 + N[(r * N[(w * N[(N[(r * w), $MachinePrecision] * -0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 - N[(N[(r * t$95$0), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := w \cdot \left(r \cdot w\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -8.2 \cdot 10^{+30}:\\
\;\;\;\;\left(-1.5 + \frac{\frac{2}{r}}{r}\right) - r \cdot \left(t_0 \cdot 0.25\right)\\
\mathbf{elif}\;v \leq 2 \cdot 10^{-31}:\\
\;\;\;\;t_1 + \left(-1.5 + r \cdot \left(w \cdot \left(\left(r \cdot w\right) \cdot -0.375\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(-1.5 - \left(r \cdot t_0\right) \cdot 0.25\right)\\
\end{array}
\end{array}
if v < -8.20000000000000011e30Initial program 79.3%
associate--l-79.3%
+-commutative79.3%
associate--l+79.3%
+-commutative79.3%
associate--r+79.3%
metadata-eval79.3%
associate-*l/85.9%
*-commutative85.9%
*-commutative85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in r around 0 85.9%
unpow285.9%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in v around inf 96.6%
associate-+r-96.6%
associate-/r*96.7%
associate-*l*96.7%
*-commutative96.7%
Applied egg-rr96.7%
if -8.20000000000000011e30 < v < 2e-31Initial program 92.2%
sub-neg92.2%
+-commutative92.2%
associate--l+92.2%
associate-/l*92.2%
distribute-neg-frac92.2%
associate-/r/92.2%
fma-def92.2%
sub-neg92.2%
Simplified86.6%
Taylor expanded in v around 0 86.6%
associate--l+86.6%
associate-*r/86.6%
metadata-eval86.6%
unpow286.6%
*-commutative86.6%
*-commutative86.6%
unpow286.6%
associate-*r*92.2%
unpow292.2%
associate-*l*92.2%
fma-neg92.2%
associate-*r*97.1%
*-commutative97.1%
*-commutative97.1%
metadata-eval97.1%
Simplified97.1%
fma-udef97.1%
associate-*l*97.2%
Applied egg-rr97.2%
if 2e-31 < v Initial program 89.7%
associate--l-89.7%
+-commutative89.7%
associate--l+89.8%
+-commutative89.8%
associate--r+89.8%
metadata-eval89.8%
associate-*l/93.4%
*-commutative93.4%
*-commutative93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in r around 0 93.4%
unpow293.4%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in v around inf 97.6%
Final simplification97.2%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= (* w w) 1e-110)
(+ t_0 (+ -1.5 (* r (* w (* (* r w) -0.375)))))
(+ t_0 (- -1.5 (* 0.375 (* w (* (* r r) w))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 1e-110) {
tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375))));
} else {
tmp = t_0 + (-1.5 - (0.375 * (w * ((r * r) * w))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((w * w) <= 1d-110) then
tmp = t_0 + ((-1.5d0) + (r * (w * ((r * w) * (-0.375d0)))))
else
tmp = t_0 + ((-1.5d0) - (0.375d0 * (w * ((r * r) * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 1e-110) {
tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375))));
} else {
tmp = t_0 + (-1.5 - (0.375 * (w * ((r * r) * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (w * w) <= 1e-110: tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375)))) else: tmp = t_0 + (-1.5 - (0.375 * (w * ((r * r) * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(w * w) <= 1e-110) tmp = Float64(t_0 + Float64(-1.5 + Float64(r * Float64(w * Float64(Float64(r * w) * -0.375))))); else tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * Float64(w * Float64(Float64(r * r) * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((w * w) <= 1e-110) tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375)))); else tmp = t_0 + (-1.5 - (0.375 * (w * ((r * r) * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(w * w), $MachinePrecision], 1e-110], N[(t$95$0 + N[(-1.5 + N[(r * N[(w * N[(N[(r * w), $MachinePrecision] * -0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(0.375 * N[(w * N[(N[(r * r), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \cdot w \leq 10^{-110}:\\
\;\;\;\;t_0 + \left(-1.5 + r \cdot \left(w \cdot \left(\left(r \cdot w\right) \cdot -0.375\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 - 0.375 \cdot \left(w \cdot \left(\left(r \cdot r\right) \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 1.0000000000000001e-110Initial program 91.2%
sub-neg91.2%
+-commutative91.2%
associate--l+91.2%
associate-/l*93.5%
distribute-neg-frac93.5%
associate-/r/93.5%
fma-def93.5%
sub-neg93.5%
Simplified82.6%
Taylor expanded in v around 0 81.9%
associate--l+81.9%
associate-*r/81.9%
metadata-eval81.9%
unpow281.9%
*-commutative81.9%
*-commutative81.9%
unpow281.9%
associate-*r*90.8%
unpow290.8%
associate-*l*90.8%
fma-neg90.8%
associate-*r*95.0%
*-commutative95.0%
*-commutative95.0%
metadata-eval95.0%
Simplified95.0%
fma-udef95.0%
associate-*l*95.0%
Applied egg-rr95.0%
if 1.0000000000000001e-110 < (*.f64 w w) Initial program 86.5%
associate--l-86.5%
+-commutative86.5%
associate--l+86.5%
+-commutative86.5%
associate--r+86.5%
metadata-eval86.5%
associate-*l/89.2%
*-commutative89.2%
*-commutative89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in r around 0 89.2%
unpow289.2%
associate-*l*95.7%
Simplified95.7%
clear-num95.7%
inv-pow95.7%
+-commutative95.7%
fma-def95.7%
Applied egg-rr95.7%
unpow-195.7%
fma-udef95.7%
*-commutative95.7%
fma-def95.7%
Simplified95.7%
Taylor expanded in v around 0 85.7%
unpow285.7%
associate-*l*95.0%
unpow295.0%
Simplified95.0%
Final simplification95.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= v 5e-29)
(+ t_0 (+ -1.5 (* r (* w (* (* r w) -0.375)))))
(+ t_0 (- -1.5 (* (* r (* w (* r w))) 0.25))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= 5e-29) {
tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375))));
} else {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
}
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 (v <= 5d-29) then
tmp = t_0 + ((-1.5d0) + (r * (w * ((r * w) * (-0.375d0)))))
else
tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * 0.25d0))
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 (v <= 5e-29) {
tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375))));
} else {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if v <= 5e-29: tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375)))) else: tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= 5e-29) tmp = Float64(t_0 + Float64(-1.5 + Float64(r * Float64(w * Float64(Float64(r * w) * -0.375))))); else tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * 0.25))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (v <= 5e-29) tmp = t_0 + (-1.5 + (r * (w * ((r * w) * -0.375)))); else tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, 5e-29], N[(t$95$0 + N[(-1.5 + N[(r * N[(w * N[(N[(r * w), $MachinePrecision] * -0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq 5 \cdot 10^{-29}:\\
\;\;\;\;t_0 + \left(-1.5 + r \cdot \left(w \cdot \left(\left(r \cdot w\right) \cdot -0.375\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\
\end{array}
\end{array}
if v < 4.99999999999999986e-29Initial program 88.2%
sub-neg88.2%
+-commutative88.2%
associate--l+88.2%
associate-/l*90.2%
distribute-neg-frac90.2%
associate-/r/90.3%
fma-def90.2%
sub-neg90.2%
Simplified85.9%
Taylor expanded in v around 0 84.6%
associate--l+84.6%
associate-*r/84.6%
metadata-eval84.6%
unpow284.6%
*-commutative84.6%
*-commutative84.6%
unpow284.6%
associate-*r*88.5%
unpow288.5%
associate-*l*88.5%
fma-neg88.5%
associate-*r*94.8%
*-commutative94.8%
*-commutative94.8%
metadata-eval94.8%
Simplified94.8%
fma-udef94.8%
associate-*l*94.8%
Applied egg-rr94.8%
if 4.99999999999999986e-29 < v Initial program 89.7%
associate--l-89.7%
+-commutative89.7%
associate--l+89.8%
+-commutative89.8%
associate--r+89.8%
metadata-eval89.8%
associate-*l/93.4%
*-commutative93.4%
*-commutative93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in r around 0 93.4%
unpow293.4%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in v around inf 97.6%
Final simplification95.6%
(FPCore (v w r)
:precision binary64
(if (or (<= r -16600000.0)
(not (or (<= r 9.8e-33) (and (not (<= r 2.9e-9)) (<= r 2.3e+97)))))
(* -0.375 (* (* r w) (* r w)))
(+ (/ 2.0 (* r r)) -1.5)))
double code(double v, double w, double r) {
double tmp;
if ((r <= -16600000.0) || !((r <= 9.8e-33) || (!(r <= 2.9e-9) && (r <= 2.3e+97)))) {
tmp = -0.375 * ((r * w) * (r * w));
} else {
tmp = (2.0 / (r * r)) + -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 <= (-16600000.0d0)) .or. (.not. (r <= 9.8d-33) .or. (.not. (r <= 2.9d-9)) .and. (r <= 2.3d+97))) then
tmp = (-0.375d0) * ((r * w) * (r * w))
else
tmp = (2.0d0 / (r * r)) + (-1.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if ((r <= -16600000.0) || !((r <= 9.8e-33) || (!(r <= 2.9e-9) && (r <= 2.3e+97)))) {
tmp = -0.375 * ((r * w) * (r * w));
} else {
tmp = (2.0 / (r * r)) + -1.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if (r <= -16600000.0) or not ((r <= 9.8e-33) or (not (r <= 2.9e-9) and (r <= 2.3e+97))): tmp = -0.375 * ((r * w) * (r * w)) else: tmp = (2.0 / (r * r)) + -1.5 return tmp
function code(v, w, r) tmp = 0.0 if ((r <= -16600000.0) || !((r <= 9.8e-33) || (!(r <= 2.9e-9) && (r <= 2.3e+97)))) tmp = Float64(-0.375 * Float64(Float64(r * w) * Float64(r * w))); else tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((r <= -16600000.0) || ~(((r <= 9.8e-33) || (~((r <= 2.9e-9)) && (r <= 2.3e+97))))) tmp = -0.375 * ((r * w) * (r * w)); else tmp = (2.0 / (r * r)) + -1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[Or[LessEqual[r, -16600000.0], N[Not[Or[LessEqual[r, 9.8e-33], And[N[Not[LessEqual[r, 2.9e-9]], $MachinePrecision], LessEqual[r, 2.3e+97]]]], $MachinePrecision]], N[(-0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq -16600000 \lor \neg \left(r \leq 9.8 \cdot 10^{-33} \lor \neg \left(r \leq 2.9 \cdot 10^{-9}\right) \land r \leq 2.3 \cdot 10^{+97}\right):\\
\;\;\;\;-0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\
\end{array}
\end{array}
if r < -1.66e7 or 9.7999999999999996e-33 < r < 2.89999999999999991e-9 or 2.30000000000000006e97 < r Initial program 87.6%
sub-neg87.6%
+-commutative87.6%
associate--l+87.7%
associate-/l*92.8%
distribute-neg-frac92.8%
associate-/r/92.9%
fma-def92.8%
sub-neg92.8%
Simplified80.6%
Taylor expanded in r around inf 69.3%
associate-/l*71.9%
unpow271.9%
*-commutative71.9%
associate-/l*72.4%
unpow272.4%
*-commutative72.4%
fma-neg72.4%
metadata-eval72.4%
Simplified72.4%
Taylor expanded in v around 0 69.9%
associate-*r*69.9%
unpow269.9%
unpow269.9%
Simplified69.9%
Taylor expanded in w around 0 69.9%
unpow269.9%
unpow269.9%
unswap-sqr80.5%
Simplified80.5%
if -1.66e7 < r < 9.7999999999999996e-33 or 2.89999999999999991e-9 < r < 2.30000000000000006e97Initial program 89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
associate-/l*90.0%
distribute-neg-frac90.0%
associate-/r/90.0%
fma-def90.0%
sub-neg90.0%
Simplified90.0%
Taylor expanded in r around 0 84.8%
sub-neg84.8%
associate-*r/84.8%
metadata-eval84.8%
unpow284.8%
metadata-eval84.8%
Simplified84.8%
Final simplification83.1%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* r w) (* r w))))
(if (<= r -54000000.0)
(* -0.25 t_0)
(if (or (<= r 1e-32) (and (not (<= r 3.6e-9)) (<= r 1.1e+97)))
(+ (/ 2.0 (* r r)) -1.5)
(* -0.375 t_0)))))
double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double tmp;
if (r <= -54000000.0) {
tmp = -0.25 * t_0;
} else if ((r <= 1e-32) || (!(r <= 3.6e-9) && (r <= 1.1e+97))) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = -0.375 * t_0;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = (r * w) * (r * w)
if (r <= (-54000000.0d0)) then
tmp = (-0.25d0) * t_0
else if ((r <= 1d-32) .or. (.not. (r <= 3.6d-9)) .and. (r <= 1.1d+97)) then
tmp = (2.0d0 / (r * r)) + (-1.5d0)
else
tmp = (-0.375d0) * t_0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double tmp;
if (r <= -54000000.0) {
tmp = -0.25 * t_0;
} else if ((r <= 1e-32) || (!(r <= 3.6e-9) && (r <= 1.1e+97))) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = -0.375 * t_0;
}
return tmp;
}
def code(v, w, r): t_0 = (r * w) * (r * w) tmp = 0 if r <= -54000000.0: tmp = -0.25 * t_0 elif (r <= 1e-32) or (not (r <= 3.6e-9) and (r <= 1.1e+97)): tmp = (2.0 / (r * r)) + -1.5 else: tmp = -0.375 * t_0 return tmp
function code(v, w, r) t_0 = Float64(Float64(r * w) * Float64(r * w)) tmp = 0.0 if (r <= -54000000.0) tmp = Float64(-0.25 * t_0); elseif ((r <= 1e-32) || (!(r <= 3.6e-9) && (r <= 1.1e+97))) tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5); else tmp = Float64(-0.375 * t_0); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (r * w) * (r * w); tmp = 0.0; if (r <= -54000000.0) tmp = -0.25 * t_0; elseif ((r <= 1e-32) || (~((r <= 3.6e-9)) && (r <= 1.1e+97))) tmp = (2.0 / (r * r)) + -1.5; else tmp = -0.375 * t_0; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, -54000000.0], N[(-0.25 * t$95$0), $MachinePrecision], If[Or[LessEqual[r, 1e-32], And[N[Not[LessEqual[r, 3.6e-9]], $MachinePrecision], LessEqual[r, 1.1e+97]]], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], N[(-0.375 * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
\mathbf{if}\;r \leq -54000000:\\
\;\;\;\;-0.25 \cdot t_0\\
\mathbf{elif}\;r \leq 10^{-32} \lor \neg \left(r \leq 3.6 \cdot 10^{-9}\right) \land r \leq 1.1 \cdot 10^{+97}:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\
\mathbf{else}:\\
\;\;\;\;-0.375 \cdot t_0\\
\end{array}
\end{array}
if r < -5.4e7Initial program 81.7%
associate--l-81.7%
+-commutative81.7%
associate--l+81.7%
+-commutative81.7%
associate--r+81.8%
metadata-eval81.8%
associate-*l/91.5%
*-commutative91.5%
*-commutative91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in r around 0 91.5%
unpow291.5%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in v around inf 89.7%
Taylor expanded in r around inf 67.9%
unpow267.9%
unpow267.9%
unswap-sqr77.9%
Simplified77.9%
if -5.4e7 < r < 1.00000000000000006e-32 or 3.6e-9 < r < 1.1e97Initial program 89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
associate-/l*90.0%
distribute-neg-frac90.0%
associate-/r/90.0%
fma-def90.0%
sub-neg90.0%
Simplified90.0%
Taylor expanded in r around 0 84.8%
sub-neg84.8%
associate-*r/84.8%
metadata-eval84.8%
unpow284.8%
metadata-eval84.8%
Simplified84.8%
if 1.00000000000000006e-32 < r < 3.6e-9 or 1.1e97 < r Initial program 94.4%
sub-neg94.4%
+-commutative94.4%
associate--l+94.4%
associate-/l*94.3%
distribute-neg-frac94.3%
associate-/r/94.4%
fma-def94.3%
sub-neg94.3%
Simplified82.2%
Taylor expanded in r around inf 75.3%
associate-/l*75.3%
unpow275.3%
*-commutative75.3%
associate-/l*75.7%
unpow275.7%
*-commutative75.7%
fma-neg75.7%
metadata-eval75.7%
Simplified75.7%
Taylor expanded in v around 0 75.5%
associate-*r*75.5%
unpow275.5%
unpow275.5%
Simplified75.5%
Taylor expanded in w around 0 75.5%
unpow275.5%
unpow275.5%
unswap-sqr86.7%
Simplified86.7%
Final simplification83.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* r w) (* r w))) (t_1 (+ (/ 2.0 (* r r)) -1.5)))
(if (<= r -24000000.0)
(* -0.25 t_0)
(if (<= r 9e-33)
t_1
(if (<= r 2.8e-9)
(* (* r r) (* (* w w) -0.375))
(if (<= r 3.2e+102) t_1 (* -0.375 t_0)))))))
double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double t_1 = (2.0 / (r * r)) + -1.5;
double tmp;
if (r <= -24000000.0) {
tmp = -0.25 * t_0;
} else if (r <= 9e-33) {
tmp = t_1;
} else if (r <= 2.8e-9) {
tmp = (r * r) * ((w * w) * -0.375);
} else if (r <= 3.2e+102) {
tmp = t_1;
} else {
tmp = -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 * w) * (r * w)
t_1 = (2.0d0 / (r * r)) + (-1.5d0)
if (r <= (-24000000.0d0)) then
tmp = (-0.25d0) * t_0
else if (r <= 9d-33) then
tmp = t_1
else if (r <= 2.8d-9) then
tmp = (r * r) * ((w * w) * (-0.375d0))
else if (r <= 3.2d+102) then
tmp = t_1
else
tmp = (-0.375d0) * t_0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double t_1 = (2.0 / (r * r)) + -1.5;
double tmp;
if (r <= -24000000.0) {
tmp = -0.25 * t_0;
} else if (r <= 9e-33) {
tmp = t_1;
} else if (r <= 2.8e-9) {
tmp = (r * r) * ((w * w) * -0.375);
} else if (r <= 3.2e+102) {
tmp = t_1;
} else {
tmp = -0.375 * t_0;
}
return tmp;
}
def code(v, w, r): t_0 = (r * w) * (r * w) t_1 = (2.0 / (r * r)) + -1.5 tmp = 0 if r <= -24000000.0: tmp = -0.25 * t_0 elif r <= 9e-33: tmp = t_1 elif r <= 2.8e-9: tmp = (r * r) * ((w * w) * -0.375) elif r <= 3.2e+102: tmp = t_1 else: tmp = -0.375 * t_0 return tmp
function code(v, w, r) t_0 = Float64(Float64(r * w) * Float64(r * w)) t_1 = Float64(Float64(2.0 / Float64(r * r)) + -1.5) tmp = 0.0 if (r <= -24000000.0) tmp = Float64(-0.25 * t_0); elseif (r <= 9e-33) tmp = t_1; elseif (r <= 2.8e-9) tmp = Float64(Float64(r * r) * Float64(Float64(w * w) * -0.375)); elseif (r <= 3.2e+102) tmp = t_1; else tmp = Float64(-0.375 * t_0); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (r * w) * (r * w); t_1 = (2.0 / (r * r)) + -1.5; tmp = 0.0; if (r <= -24000000.0) tmp = -0.25 * t_0; elseif (r <= 9e-33) tmp = t_1; elseif (r <= 2.8e-9) tmp = (r * r) * ((w * w) * -0.375); elseif (r <= 3.2e+102) tmp = t_1; else tmp = -0.375 * t_0; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]}, If[LessEqual[r, -24000000.0], N[(-0.25 * t$95$0), $MachinePrecision], If[LessEqual[r, 9e-33], t$95$1, If[LessEqual[r, 2.8e-9], N[(N[(r * r), $MachinePrecision] * N[(N[(w * w), $MachinePrecision] * -0.375), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 3.2e+102], t$95$1, N[(-0.375 * t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
t_1 := \frac{2}{r \cdot r} + -1.5\\
\mathbf{if}\;r \leq -24000000:\\
\;\;\;\;-0.25 \cdot t_0\\
\mathbf{elif}\;r \leq 9 \cdot 10^{-33}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;r \leq 2.8 \cdot 10^{-9}:\\
\;\;\;\;\left(r \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot -0.375\right)\\
\mathbf{elif}\;r \leq 3.2 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-0.375 \cdot t_0\\
\end{array}
\end{array}
if r < -2.4e7Initial program 81.7%
associate--l-81.7%
+-commutative81.7%
associate--l+81.7%
+-commutative81.7%
associate--r+81.8%
metadata-eval81.8%
associate-*l/91.5%
*-commutative91.5%
*-commutative91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in r around 0 91.5%
unpow291.5%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in v around inf 89.7%
Taylor expanded in r around inf 67.9%
unpow267.9%
unpow267.9%
unswap-sqr77.9%
Simplified77.9%
if -2.4e7 < r < 8.99999999999999982e-33 or 2.79999999999999984e-9 < r < 3.1999999999999999e102Initial program 89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
associate-/l*90.0%
distribute-neg-frac90.0%
associate-/r/90.0%
fma-def90.0%
sub-neg90.0%
Simplified90.0%
Taylor expanded in r around 0 84.8%
sub-neg84.8%
associate-*r/84.8%
metadata-eval84.8%
unpow284.8%
metadata-eval84.8%
Simplified84.8%
if 8.99999999999999982e-33 < r < 2.79999999999999984e-9Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate--l+100.0%
associate-/l*99.7%
distribute-neg-frac99.7%
associate-/r/100.0%
fma-def100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in r around inf 89.8%
associate-/l*89.8%
unpow289.8%
*-commutative89.8%
associate-/l*89.8%
unpow289.8%
*-commutative89.8%
fma-neg89.8%
metadata-eval89.8%
Simplified89.8%
Taylor expanded in v around 0 90.1%
associate-*r*90.1%
unpow290.1%
unpow290.1%
Simplified90.1%
if 3.1999999999999999e102 < r Initial program 93.8%
sub-neg93.8%
+-commutative93.8%
associate--l+93.8%
associate-/l*93.7%
distribute-neg-frac93.7%
associate-/r/93.8%
fma-def93.7%
sub-neg93.7%
Simplified80.2%
Taylor expanded in r around inf 73.6%
associate-/l*73.6%
unpow273.6%
*-commutative73.6%
associate-/l*74.1%
unpow274.1%
*-commutative74.1%
fma-neg74.1%
metadata-eval74.1%
Simplified74.1%
Taylor expanded in v around 0 73.8%
associate-*r*73.8%
unpow273.8%
unpow273.8%
Simplified73.8%
Taylor expanded in w around 0 73.8%
unpow273.8%
unpow273.8%
unswap-sqr86.4%
Simplified86.4%
Final simplification83.7%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (* r (* w (* (* r w) -0.375))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (r * (w * ((r * w) * -0.375))));
}
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)))))
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))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + (r * (w * ((r * w) * -0.375))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(r * Float64(w * Float64(Float64(r * w) * -0.375))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + (r * (w * ((r * w) * -0.375)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(r * N[(w * N[(N[(r * w), $MachinePrecision] * -0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + r \cdot \left(w \cdot \left(\left(r \cdot w\right) \cdot -0.375\right)\right)\right)
\end{array}
Initial program 88.7%
sub-neg88.7%
+-commutative88.7%
associate--l+88.7%
associate-/l*91.2%
distribute-neg-frac91.2%
associate-/r/91.2%
fma-def91.2%
sub-neg91.2%
Simplified86.2%
Taylor expanded in v around 0 84.0%
associate--l+84.0%
associate-*r/84.0%
metadata-eval84.0%
unpow284.0%
*-commutative84.0%
*-commutative84.0%
unpow284.0%
associate-*r*88.1%
unpow288.1%
associate-*l*88.1%
fma-neg88.1%
associate-*r*93.4%
*-commutative93.4%
*-commutative93.4%
metadata-eval93.4%
Simplified93.4%
fma-udef93.4%
associate-*l*93.4%
Applied egg-rr93.4%
Final simplification93.4%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) -1.5))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + -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 = (2.0d0 / (r * r)) + (-1.5d0)
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + -1.5;
}
def code(v, w, r): return (2.0 / (r * r)) + -1.5
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + -1.5) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + -1.5; end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + -1.5
\end{array}
Initial program 88.7%
sub-neg88.7%
+-commutative88.7%
associate--l+88.7%
associate-/l*91.2%
distribute-neg-frac91.2%
associate-/r/91.2%
fma-def91.2%
sub-neg91.2%
Simplified86.2%
Taylor expanded in r around 0 56.0%
sub-neg56.0%
associate-*r/56.0%
metadata-eval56.0%
unpow256.0%
metadata-eval56.0%
Simplified56.0%
Final simplification56.0%
(FPCore (v w r) :precision binary64 (/ 2.0 (* r r)))
double code(double v, double w, double r) {
return 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 = 2.0d0 / (r * r)
end function
public static double code(double v, double w, double r) {
return 2.0 / (r * r);
}
def code(v, w, r): return 2.0 / (r * r)
function code(v, w, r) return Float64(2.0 / Float64(r * r)) end
function tmp = code(v, w, r) tmp = 2.0 / (r * r); end
code[v_, w_, r_] := N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r}
\end{array}
Initial program 88.7%
associate--l-88.7%
+-commutative88.7%
associate--l+88.7%
+-commutative88.7%
associate--r+88.7%
metadata-eval88.7%
associate-*l/91.2%
*-commutative91.2%
*-commutative91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in r around 0 91.2%
unpow291.2%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in v around inf 91.7%
Taylor expanded in r around 0 43.8%
unpow243.8%
Simplified43.8%
Final simplification43.8%
herbie shell --seed 2023171
(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))