
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ a b))))
double code(double r, double a, double b) {
return (r * sin(b)) / cos((a + b));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (r * sin(b)) / cos((a + b))
end function
public static double code(double r, double a, double b) {
return (r * Math.sin(b)) / Math.cos((a + b));
}
def code(r, a, b): return (r * math.sin(b)) / math.cos((a + b))
function code(r, a, b) return Float64(Float64(r * sin(b)) / cos(Float64(a + b))) end
function tmp = code(r, a, b) tmp = (r * sin(b)) / cos((a + b)); end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\cos \left(a + b\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ a b))))
double code(double r, double a, double b) {
return (r * sin(b)) / cos((a + b));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (r * sin(b)) / cos((a + b))
end function
public static double code(double r, double a, double b) {
return (r * Math.sin(b)) / Math.cos((a + b));
}
def code(r, a, b): return (r * math.sin(b)) / math.cos((a + b))
function code(r, a, b) return Float64(Float64(r * sin(b)) / cos(Float64(a + b))) end
function tmp = code(r, a, b) tmp = (r * sin(b)) / cos((a + b)); end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\cos \left(a + b\right)}
\end{array}
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (fma (cos b) (cos a) (- (* (sin b) (sin a))))))
double code(double r, double a, double b) {
return (r * sin(b)) / fma(cos(b), cos(a), -(sin(b) * sin(a)));
}
function code(r, a, b) return Float64(Float64(r * sin(b)) / fma(cos(b), cos(a), Float64(-Float64(sin(b) * sin(a))))) end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision] + (-N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, -\sin b \cdot \sin a\right)}
\end{array}
Initial program 76.1%
+-commutative76.1%
Simplified76.1%
cos-sum99.4%
cancel-sign-sub-inv99.4%
fma-def99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (r a b) :precision binary64 (/ (sin b) (/ (fma (cos b) (cos a) (- (* (sin b) (sin a)))) r)))
double code(double r, double a, double b) {
return sin(b) / (fma(cos(b), cos(a), -(sin(b) * sin(a))) / r);
}
function code(r, a, b) return Float64(sin(b) / Float64(fma(cos(b), cos(a), Float64(-Float64(sin(b) * sin(a)))) / r)) end
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision] + (-N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision])), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin b}{\frac{\mathsf{fma}\left(\cos b, \cos a, -\sin b \cdot \sin a\right)}{r}}
\end{array}
Initial program 76.1%
*-commutative76.1%
associate-/l*76.1%
+-commutative76.1%
Simplified76.1%
cos-sum99.4%
cancel-sign-sub-inv99.4%
fma-def99.5%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (r a b) :precision binary64 (/ r (/ (- (* (cos b) (cos a)) (* (sin b) (sin a))) (sin b))))
double code(double r, double a, double b) {
return r / (((cos(b) * cos(a)) - (sin(b) * sin(a))) / sin(b));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r / (((cos(b) * cos(a)) - (sin(b) * sin(a))) / sin(b))
end function
public static double code(double r, double a, double b) {
return r / (((Math.cos(b) * Math.cos(a)) - (Math.sin(b) * Math.sin(a))) / Math.sin(b));
}
def code(r, a, b): return r / (((math.cos(b) * math.cos(a)) - (math.sin(b) * math.sin(a))) / math.sin(b))
function code(r, a, b) return Float64(r / Float64(Float64(Float64(cos(b) * cos(a)) - Float64(sin(b) * sin(a))) / sin(b))) end
function tmp = code(r, a, b) tmp = r / (((cos(b) * cos(a)) - (sin(b) * sin(a))) / sin(b)); end
code[r_, a_, b_] := N[(r / N[(N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r}{\frac{\cos b \cdot \cos a - \sin b \cdot \sin a}{\sin b}}
\end{array}
Initial program 76.1%
+-commutative76.1%
Simplified76.1%
cos-sum99.4%
cancel-sign-sub-inv99.4%
fma-def99.5%
Applied egg-rr99.5%
Taylor expanded in r around 0 99.4%
associate-/l*99.4%
neg-mul-199.4%
+-commutative99.4%
sub-neg99.4%
*-commutative99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (r a b) :precision binary64 (/ (sin b) (/ (- (* (cos b) (cos a)) (* (sin b) (sin a))) r)))
double code(double r, double a, double b) {
return sin(b) / (((cos(b) * cos(a)) - (sin(b) * sin(a))) / r);
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = sin(b) / (((cos(b) * cos(a)) - (sin(b) * sin(a))) / r)
end function
public static double code(double r, double a, double b) {
return Math.sin(b) / (((Math.cos(b) * Math.cos(a)) - (Math.sin(b) * Math.sin(a))) / r);
}
def code(r, a, b): return math.sin(b) / (((math.cos(b) * math.cos(a)) - (math.sin(b) * math.sin(a))) / r)
function code(r, a, b) return Float64(sin(b) / Float64(Float64(Float64(cos(b) * cos(a)) - Float64(sin(b) * sin(a))) / r)) end
function tmp = code(r, a, b) tmp = sin(b) / (((cos(b) * cos(a)) - (sin(b) * sin(a))) / r); end
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] / N[(N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin b}{\frac{\cos b \cdot \cos a - \sin b \cdot \sin a}{r}}
\end{array}
Initial program 76.1%
*-commutative76.1%
associate-/l*76.1%
+-commutative76.1%
Simplified76.1%
cos-sum99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (- (* (cos b) (cos a)) (* (sin b) (sin a)))))
double code(double r, double a, double b) {
return (r * sin(b)) / ((cos(b) * cos(a)) - (sin(b) * sin(a)));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (r * sin(b)) / ((cos(b) * cos(a)) - (sin(b) * sin(a)))
end function
public static double code(double r, double a, double b) {
return (r * Math.sin(b)) / ((Math.cos(b) * Math.cos(a)) - (Math.sin(b) * Math.sin(a)));
}
def code(r, a, b): return (r * math.sin(b)) / ((math.cos(b) * math.cos(a)) - (math.sin(b) * math.sin(a)))
function code(r, a, b) return Float64(Float64(r * sin(b)) / Float64(Float64(cos(b) * cos(a)) - Float64(sin(b) * sin(a)))) end
function tmp = code(r, a, b) tmp = (r * sin(b)) / ((cos(b) * cos(a)) - (sin(b) * sin(a))); end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\cos b \cdot \cos a - \sin b \cdot \sin a}
\end{array}
Initial program 76.1%
+-commutative76.1%
Simplified76.1%
cos-sum99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (r a b) :precision binary64 (if (or (<= a -0.00058) (not (<= a 3.15e-6))) (* (sin b) (/ r (cos a))) (* (sin b) (/ r (cos b)))))
double code(double r, double a, double b) {
double tmp;
if ((a <= -0.00058) || !(a <= 3.15e-6)) {
tmp = sin(b) * (r / cos(a));
} else {
tmp = sin(b) * (r / cos(b));
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-0.00058d0)) .or. (.not. (a <= 3.15d-6))) then
tmp = sin(b) * (r / cos(a))
else
tmp = sin(b) * (r / cos(b))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if ((a <= -0.00058) || !(a <= 3.15e-6)) {
tmp = Math.sin(b) * (r / Math.cos(a));
} else {
tmp = Math.sin(b) * (r / Math.cos(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (a <= -0.00058) or not (a <= 3.15e-6): tmp = math.sin(b) * (r / math.cos(a)) else: tmp = math.sin(b) * (r / math.cos(b)) return tmp
function code(r, a, b) tmp = 0.0 if ((a <= -0.00058) || !(a <= 3.15e-6)) tmp = Float64(sin(b) * Float64(r / cos(a))); else tmp = Float64(sin(b) * Float64(r / cos(b))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if ((a <= -0.00058) || ~((a <= 3.15e-6))) tmp = sin(b) * (r / cos(a)); else tmp = sin(b) * (r / cos(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[a, -0.00058], N[Not[LessEqual[a, 3.15e-6]], $MachinePrecision]], N[(N[Sin[b], $MachinePrecision] * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[b], $MachinePrecision] * N[(r / N[Cos[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.00058 \lor \neg \left(a \leq 3.15 \cdot 10^{-6}\right):\\
\;\;\;\;\sin b \cdot \frac{r}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\sin b \cdot \frac{r}{\cos b}\\
\end{array}
\end{array}
if a < -5.8e-4 or 3.14999999999999991e-6 < a Initial program 51.3%
*-commutative51.3%
associate-/l*51.3%
+-commutative51.3%
Simplified51.3%
clear-num50.7%
associate-/r/51.3%
clear-num51.3%
Applied egg-rr51.3%
Taylor expanded in b around 0 51.4%
if -5.8e-4 < a < 3.14999999999999991e-6Initial program 98.4%
*-commutative98.4%
associate-/l*98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in a around 0 98.4%
associate-/l*98.2%
associate-/r/98.5%
Simplified98.5%
Final simplification76.2%
(FPCore (r a b) :precision binary64 (if (<= a -3.6e-5) (/ (sin b) (/ (cos a) r)) (if (<= a 3.15e-6) (* (sin b) (/ r (cos b))) (* (sin b) (/ r (cos a))))))
double code(double r, double a, double b) {
double tmp;
if (a <= -3.6e-5) {
tmp = sin(b) / (cos(a) / r);
} else if (a <= 3.15e-6) {
tmp = sin(b) * (r / cos(b));
} else {
tmp = sin(b) * (r / cos(a));
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-3.6d-5)) then
tmp = sin(b) / (cos(a) / r)
else if (a <= 3.15d-6) then
tmp = sin(b) * (r / cos(b))
else
tmp = sin(b) * (r / cos(a))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (a <= -3.6e-5) {
tmp = Math.sin(b) / (Math.cos(a) / r);
} else if (a <= 3.15e-6) {
tmp = Math.sin(b) * (r / Math.cos(b));
} else {
tmp = Math.sin(b) * (r / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if a <= -3.6e-5: tmp = math.sin(b) / (math.cos(a) / r) elif a <= 3.15e-6: tmp = math.sin(b) * (r / math.cos(b)) else: tmp = math.sin(b) * (r / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if (a <= -3.6e-5) tmp = Float64(sin(b) / Float64(cos(a) / r)); elseif (a <= 3.15e-6) tmp = Float64(sin(b) * Float64(r / cos(b))); else tmp = Float64(sin(b) * Float64(r / cos(a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (a <= -3.6e-5) tmp = sin(b) / (cos(a) / r); elseif (a <= 3.15e-6) tmp = sin(b) * (r / cos(b)); else tmp = sin(b) * (r / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[a, -3.6e-5], N[(N[Sin[b], $MachinePrecision] / N[(N[Cos[a], $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.15e-6], N[(N[Sin[b], $MachinePrecision] * N[(r / N[Cos[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[b], $MachinePrecision] * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.6 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin b}{\frac{\cos a}{r}}\\
\mathbf{elif}\;a \leq 3.15 \cdot 10^{-6}:\\
\;\;\;\;\sin b \cdot \frac{r}{\cos b}\\
\mathbf{else}:\\
\;\;\;\;\sin b \cdot \frac{r}{\cos a}\\
\end{array}
\end{array}
if a < -3.60000000000000009e-5Initial program 53.7%
*-commutative53.7%
associate-/l*53.7%
+-commutative53.7%
Simplified53.7%
Taylor expanded in b around 0 53.6%
if -3.60000000000000009e-5 < a < 3.14999999999999991e-6Initial program 98.4%
*-commutative98.4%
associate-/l*98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in a around 0 98.4%
associate-/l*98.2%
associate-/r/98.5%
Simplified98.5%
if 3.14999999999999991e-6 < a Initial program 49.2%
*-commutative49.2%
associate-/l*49.3%
+-commutative49.3%
Simplified49.3%
clear-num48.7%
associate-/r/49.3%
clear-num49.4%
Applied egg-rr49.4%
Taylor expanded in b around 0 49.7%
Final simplification76.3%
(FPCore (r a b) :precision binary64 (* (sin b) (/ r (cos (+ b a)))))
double code(double r, double a, double b) {
return sin(b) * (r / cos((b + a)));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = sin(b) * (r / cos((b + a)))
end function
public static double code(double r, double a, double b) {
return Math.sin(b) * (r / Math.cos((b + a)));
}
def code(r, a, b): return math.sin(b) * (r / math.cos((b + a)))
function code(r, a, b) return Float64(sin(b) * Float64(r / cos(Float64(b + a)))) end
function tmp = code(r, a, b) tmp = sin(b) * (r / cos((b + a))); end
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] * N[(r / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin b \cdot \frac{r}{\cos \left(b + a\right)}
\end{array}
Initial program 76.1%
*-commutative76.1%
associate-/l*76.1%
+-commutative76.1%
Simplified76.1%
clear-num75.2%
associate-/r/76.1%
clear-num76.2%
Applied egg-rr76.2%
Final simplification76.2%
(FPCore (r a b) :precision binary64 (* (sin b) (/ r (cos a))))
double code(double r, double a, double b) {
return sin(b) * (r / cos(a));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = sin(b) * (r / cos(a))
end function
public static double code(double r, double a, double b) {
return Math.sin(b) * (r / Math.cos(a));
}
def code(r, a, b): return math.sin(b) * (r / math.cos(a))
function code(r, a, b) return Float64(sin(b) * Float64(r / cos(a))) end
function tmp = code(r, a, b) tmp = sin(b) * (r / cos(a)); end
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin b \cdot \frac{r}{\cos a}
\end{array}
Initial program 76.1%
*-commutative76.1%
associate-/l*76.1%
+-commutative76.1%
Simplified76.1%
clear-num75.2%
associate-/r/76.1%
clear-num76.2%
Applied egg-rr76.2%
Taylor expanded in b around 0 51.8%
Final simplification51.8%
(FPCore (r a b) :precision binary64 (if (or (<= b -2.05e+15) (not (<= b 1350000000.0))) (* r (sin b)) (* r (/ b (cos a)))))
double code(double r, double a, double b) {
double tmp;
if ((b <= -2.05e+15) || !(b <= 1350000000.0)) {
tmp = r * sin(b);
} else {
tmp = r * (b / cos(a));
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b <= (-2.05d+15)) .or. (.not. (b <= 1350000000.0d0))) then
tmp = r * sin(b)
else
tmp = r * (b / cos(a))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if ((b <= -2.05e+15) || !(b <= 1350000000.0)) {
tmp = r * Math.sin(b);
} else {
tmp = r * (b / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (b <= -2.05e+15) or not (b <= 1350000000.0): tmp = r * math.sin(b) else: tmp = r * (b / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if ((b <= -2.05e+15) || !(b <= 1350000000.0)) tmp = Float64(r * sin(b)); else tmp = Float64(r * Float64(b / cos(a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if ((b <= -2.05e+15) || ~((b <= 1350000000.0))) tmp = r * sin(b); else tmp = r * (b / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[b, -2.05e+15], N[Not[LessEqual[b, 1350000000.0]], $MachinePrecision]], N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.05 \cdot 10^{+15} \lor \neg \left(b \leq 1350000000\right):\\
\;\;\;\;r \cdot \sin b\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\end{array}
\end{array}
if b < -2.05e15 or 1.35e9 < b Initial program 58.1%
*-commutative58.1%
associate-/l*58.2%
+-commutative58.2%
Simplified58.2%
frac-2neg58.2%
div-inv58.1%
distribute-neg-frac58.1%
Applied egg-rr58.1%
Taylor expanded in a around 0 56.4%
mul-1-neg56.4%
unsub-neg56.4%
Simplified56.4%
Taylor expanded in b around 0 10.7%
mul-1-neg10.7%
Simplified10.7%
if -2.05e15 < b < 1.35e9Initial program 94.1%
*-commutative94.1%
associate-/l*94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in b around 0 93.0%
associate-/l*92.9%
associate-/r/93.0%
Simplified93.0%
Final simplification51.9%
(FPCore (r a b) :precision binary64 (* r (sin b)))
double code(double r, double a, double b) {
return r * sin(b);
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r * sin(b)
end function
public static double code(double r, double a, double b) {
return r * Math.sin(b);
}
def code(r, a, b): return r * math.sin(b)
function code(r, a, b) return Float64(r * sin(b)) end
function tmp = code(r, a, b) tmp = r * sin(b); end
code[r_, a_, b_] := N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \sin b
\end{array}
Initial program 76.1%
*-commutative76.1%
associate-/l*76.1%
+-commutative76.1%
Simplified76.1%
frac-2neg76.1%
div-inv76.1%
distribute-neg-frac76.1%
Applied egg-rr76.1%
Taylor expanded in a around 0 59.9%
mul-1-neg59.9%
unsub-neg59.9%
Simplified59.9%
Taylor expanded in b around 0 37.0%
mul-1-neg37.0%
Simplified37.0%
Final simplification37.0%
(FPCore (r a b) :precision binary64 (* r b))
double code(double r, double a, double b) {
return r * b;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r * b
end function
public static double code(double r, double a, double b) {
return r * b;
}
def code(r, a, b): return r * b
function code(r, a, b) return Float64(r * b) end
function tmp = code(r, a, b) tmp = r * b; end
code[r_, a_, b_] := N[(r * b), $MachinePrecision]
\begin{array}{l}
\\
r \cdot b
\end{array}
Initial program 76.1%
*-commutative76.1%
associate-/l*76.1%
+-commutative76.1%
Simplified76.1%
Taylor expanded in b around 0 48.2%
associate-/l*48.1%
associate-/r/48.2%
Simplified48.2%
Taylor expanded in a around 0 33.3%
*-commutative33.3%
Simplified33.3%
Final simplification33.3%
herbie shell --seed 2023291
(FPCore (r a b)
:name "rsin A (should all be same)"
:precision binary64
(/ (* r (sin b)) (cos (+ a b))))