
(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 11 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 (* (/ (sin b) (- (* (cos b) (cos a)) (expm1 (log1p (* (sin b) (sin a)))))) r))
double code(double r, double a, double b) {
return (sin(b) / ((cos(b) * cos(a)) - expm1(log1p((sin(b) * sin(a)))))) * r;
}
public static double code(double r, double a, double b) {
return (Math.sin(b) / ((Math.cos(b) * Math.cos(a)) - Math.expm1(Math.log1p((Math.sin(b) * Math.sin(a)))))) * r;
}
def code(r, a, b): return (math.sin(b) / ((math.cos(b) * math.cos(a)) - math.expm1(math.log1p((math.sin(b) * math.sin(a)))))) * r
function code(r, a, b) return Float64(Float64(sin(b) / Float64(Float64(cos(b) * cos(a)) - expm1(log1p(Float64(sin(b) * sin(a)))))) * r) end
code[r_, a_, b_] := N[(N[(N[Sin[b], $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(Exp[N[Log[1 + N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin b}{\cos b \cdot \cos a - \mathsf{expm1}\left(\mathsf{log1p}\left(\sin b \cdot \sin a\right)\right)} \cdot r
\end{array}
Initial program 72.9%
associate-*r/72.9%
*-commutative72.9%
+-commutative72.9%
Simplified72.9%
cos-sum99.4%
Applied egg-rr99.4%
expm1-log1p-u99.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(r * Float64(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[(r * N[(N[Sin[b], $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \sin a}
\end{array}
Initial program 72.9%
associate-*r/72.9%
*-commutative72.9%
+-commutative72.9%
Simplified72.9%
cos-sum99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (r a b) :precision binary64 (if (or (<= b -1.0) (not (<= b 5e-16))) (* r (/ (sin b) (cos b))) (* r (/ b (cos a)))))
double code(double r, double a, double b) {
double tmp;
if ((b <= -1.0) || !(b <= 5e-16)) {
tmp = r * (sin(b) / cos(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 <= (-1.0d0)) .or. (.not. (b <= 5d-16))) then
tmp = r * (sin(b) / cos(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 <= -1.0) || !(b <= 5e-16)) {
tmp = r * (Math.sin(b) / Math.cos(b));
} else {
tmp = r * (b / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (b <= -1.0) or not (b <= 5e-16): tmp = r * (math.sin(b) / math.cos(b)) else: tmp = r * (b / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if ((b <= -1.0) || !(b <= 5e-16)) tmp = Float64(r * Float64(sin(b) / cos(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 <= -1.0) || ~((b <= 5e-16))) tmp = r * (sin(b) / cos(b)); else tmp = r * (b / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[b, -1.0], N[Not[LessEqual[b, 5e-16]], $MachinePrecision]], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \lor \neg \left(b \leq 5 \cdot 10^{-16}\right):\\
\;\;\;\;r \cdot \frac{\sin b}{\cos b}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\end{array}
\end{array}
if b < -1 or 5.0000000000000004e-16 < b Initial program 51.2%
associate-*r/51.2%
*-commutative51.2%
+-commutative51.2%
Simplified51.2%
Taylor expanded in a around 0 51.6%
if -1 < b < 5.0000000000000004e-16Initial program 98.7%
associate-*r/98.8%
*-commutative98.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in b around 0 98.7%
Final simplification73.1%
(FPCore (r a b) :precision binary64 (if (<= b -1.0) (/ r (/ (cos b) (sin b))) (if (<= b 5e-16) (* r (/ b (cos a))) (* r (/ (sin b) (cos b))))))
double code(double r, double a, double b) {
double tmp;
if (b <= -1.0) {
tmp = r / (cos(b) / sin(b));
} else if (b <= 5e-16) {
tmp = r * (b / cos(a));
} else {
tmp = r * (sin(b) / 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 (b <= (-1.0d0)) then
tmp = r / (cos(b) / sin(b))
else if (b <= 5d-16) then
tmp = r * (b / cos(a))
else
tmp = r * (sin(b) / cos(b))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= -1.0) {
tmp = r / (Math.cos(b) / Math.sin(b));
} else if (b <= 5e-16) {
tmp = r * (b / Math.cos(a));
} else {
tmp = r * (Math.sin(b) / Math.cos(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -1.0: tmp = r / (math.cos(b) / math.sin(b)) elif b <= 5e-16: tmp = r * (b / math.cos(a)) else: tmp = r * (math.sin(b) / math.cos(b)) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -1.0) tmp = Float64(r / Float64(cos(b) / sin(b))); elseif (b <= 5e-16) tmp = Float64(r * Float64(b / cos(a))); else tmp = Float64(r * Float64(sin(b) / cos(b))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -1.0) tmp = r / (cos(b) / sin(b)); elseif (b <= 5e-16) tmp = r * (b / cos(a)); else tmp = r * (sin(b) / cos(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -1.0], N[(r / N[(N[Cos[b], $MachinePrecision] / N[Sin[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5e-16], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1:\\
\;\;\;\;\frac{r}{\frac{\cos b}{\sin b}}\\
\mathbf{elif}\;b \leq 5 \cdot 10^{-16}:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos b}\\
\end{array}
\end{array}
if b < -1Initial program 53.4%
associate-/l*53.4%
+-commutative53.4%
Simplified53.4%
Taylor expanded in a around 0 54.6%
if -1 < b < 5.0000000000000004e-16Initial program 98.7%
associate-*r/98.8%
*-commutative98.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in b around 0 98.7%
if 5.0000000000000004e-16 < b Initial program 49.7%
associate-*r/49.7%
*-commutative49.7%
+-commutative49.7%
Simplified49.7%
Taylor expanded in a around 0 49.6%
Final simplification73.1%
(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 72.9%
associate-/l*72.8%
+-commutative72.8%
Simplified72.8%
associate-/r/72.9%
Applied egg-rr72.9%
Final simplification72.9%
(FPCore (r a b) :precision binary64 (* r (/ (sin b) (cos (+ b a)))))
double code(double r, double a, double b) {
return r * (sin(b) / 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 = r * (sin(b) / cos((b + a)))
end function
public static double code(double r, double a, double b) {
return r * (Math.sin(b) / Math.cos((b + a)));
}
def code(r, a, b): return r * (math.sin(b) / math.cos((b + a)))
function code(r, a, b) return Float64(r * Float64(sin(b) / cos(Float64(b + a)))) end
function tmp = code(r, a, b) tmp = r * (sin(b) / cos((b + a))); end
code[r_, a_, b_] := N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{\sin b}{\cos \left(b + a\right)}
\end{array}
Initial program 72.9%
associate-*r/72.9%
*-commutative72.9%
+-commutative72.9%
Simplified72.9%
Final simplification72.9%
(FPCore (r a b) :precision binary64 (if (<= b 5e-16) (* r (/ b (cos a))) (/ r (- (/ 1.0 b) (sin a)))))
double code(double r, double a, double b) {
double tmp;
if (b <= 5e-16) {
tmp = r * (b / cos(a));
} else {
tmp = r / ((1.0 / b) - sin(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 <= 5d-16) then
tmp = r * (b / cos(a))
else
tmp = r / ((1.0d0 / b) - sin(a))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= 5e-16) {
tmp = r * (b / Math.cos(a));
} else {
tmp = r / ((1.0 / b) - Math.sin(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= 5e-16: tmp = r * (b / math.cos(a)) else: tmp = r / ((1.0 / b) - math.sin(a)) return tmp
function code(r, a, b) tmp = 0.0 if (b <= 5e-16) tmp = Float64(r * Float64(b / cos(a))); else tmp = Float64(r / Float64(Float64(1.0 / b) - sin(a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= 5e-16) tmp = r * (b / cos(a)); else tmp = r / ((1.0 / b) - sin(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, 5e-16], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r / N[(N[(1.0 / b), $MachinePrecision] - N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5 \cdot 10^{-16}:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{b} - \sin a}\\
\end{array}
\end{array}
if b < 5.0000000000000004e-16Initial program 84.2%
associate-*r/84.3%
*-commutative84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in b around 0 68.3%
if 5.0000000000000004e-16 < b Initial program 49.7%
associate-/l*49.7%
+-commutative49.7%
Simplified49.7%
Taylor expanded in b around 0 12.5%
neg-mul-112.5%
+-commutative12.5%
unsub-neg12.5%
Simplified12.5%
Taylor expanded in a around 0 12.5%
Final simplification50.0%
(FPCore (r a b) :precision binary64 (if (<= b 1.1) (* r (/ b (cos a))) (/ (- r) (sin a))))
double code(double r, double a, double b) {
double tmp;
if (b <= 1.1) {
tmp = r * (b / cos(a));
} else {
tmp = -r / sin(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 <= 1.1d0) then
tmp = r * (b / cos(a))
else
tmp = -r / sin(a)
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= 1.1) {
tmp = r * (b / Math.cos(a));
} else {
tmp = -r / Math.sin(a);
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= 1.1: tmp = r * (b / math.cos(a)) else: tmp = -r / math.sin(a) return tmp
function code(r, a, b) tmp = 0.0 if (b <= 1.1) tmp = Float64(r * Float64(b / cos(a))); else tmp = Float64(Float64(-r) / sin(a)); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= 1.1) tmp = r * (b / cos(a)); else tmp = -r / sin(a); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, 1.1], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-r) / N[Sin[a], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.1:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-r}{\sin a}\\
\end{array}
\end{array}
if b < 1.1000000000000001Initial program 84.4%
associate-*r/84.5%
*-commutative84.5%
+-commutative84.5%
Simplified84.5%
Taylor expanded in b around 0 68.4%
if 1.1000000000000001 < b Initial program 48.5%
associate-/l*48.5%
+-commutative48.5%
Simplified48.5%
Taylor expanded in b around 0 11.0%
neg-mul-111.0%
+-commutative11.0%
unsub-neg11.0%
Simplified11.0%
Taylor expanded in b around inf 10.8%
associate-*r/10.8%
neg-mul-110.8%
Simplified10.8%
Final simplification49.9%
(FPCore (r a b) :precision binary64 (if (<= b 5.5e+16) (/ r (+ (/ 1.0 b) (* b -0.3333333333333333))) (/ (- r) (sin a))))
double code(double r, double a, double b) {
double tmp;
if (b <= 5.5e+16) {
tmp = r / ((1.0 / b) + (b * -0.3333333333333333));
} else {
tmp = -r / sin(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 <= 5.5d+16) then
tmp = r / ((1.0d0 / b) + (b * (-0.3333333333333333d0)))
else
tmp = -r / sin(a)
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= 5.5e+16) {
tmp = r / ((1.0 / b) + (b * -0.3333333333333333));
} else {
tmp = -r / Math.sin(a);
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= 5.5e+16: tmp = r / ((1.0 / b) + (b * -0.3333333333333333)) else: tmp = -r / math.sin(a) return tmp
function code(r, a, b) tmp = 0.0 if (b <= 5.5e+16) tmp = Float64(r / Float64(Float64(1.0 / b) + Float64(b * -0.3333333333333333))); else tmp = Float64(Float64(-r) / sin(a)); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= 5.5e+16) tmp = r / ((1.0 / b) + (b * -0.3333333333333333)); else tmp = -r / sin(a); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, 5.5e+16], N[(r / N[(N[(1.0 / b), $MachinePrecision] + N[(b * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-r) / N[Sin[a], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.5 \cdot 10^{+16}:\\
\;\;\;\;\frac{r}{\frac{1}{b} + b \cdot -0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;\frac{-r}{\sin a}\\
\end{array}
\end{array}
if b < 5.5e16Initial program 83.5%
associate-/l*83.5%
+-commutative83.5%
Simplified83.5%
Taylor expanded in b around 0 66.6%
fma-def66.6%
distribute-rgt-out--66.6%
metadata-eval66.6%
neg-mul-166.6%
+-commutative66.6%
unsub-neg66.6%
Simplified66.6%
Taylor expanded in a around 0 42.8%
if 5.5e16 < b Initial program 47.2%
associate-/l*47.2%
+-commutative47.2%
Simplified47.2%
Taylor expanded in b around 0 11.1%
neg-mul-111.1%
+-commutative11.1%
unsub-neg11.1%
Simplified11.1%
Taylor expanded in b around inf 11.1%
associate-*r/11.1%
neg-mul-111.1%
Simplified11.1%
Final simplification33.5%
(FPCore (r a b) :precision binary64 (/ r (+ (/ 1.0 b) (* b -0.3333333333333333))))
double code(double r, double a, double b) {
return r / ((1.0 / b) + (b * -0.3333333333333333));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r / ((1.0d0 / b) + (b * (-0.3333333333333333d0)))
end function
public static double code(double r, double a, double b) {
return r / ((1.0 / b) + (b * -0.3333333333333333));
}
def code(r, a, b): return r / ((1.0 / b) + (b * -0.3333333333333333))
function code(r, a, b) return Float64(r / Float64(Float64(1.0 / b) + Float64(b * -0.3333333333333333))) end
function tmp = code(r, a, b) tmp = r / ((1.0 / b) + (b * -0.3333333333333333)); end
code[r_, a_, b_] := N[(r / N[(N[(1.0 / b), $MachinePrecision] + N[(b * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r}{\frac{1}{b} + b \cdot -0.3333333333333333}
\end{array}
Initial program 72.9%
associate-/l*72.8%
+-commutative72.8%
Simplified72.8%
Taylor expanded in b around 0 48.5%
fma-def48.5%
distribute-rgt-out--48.5%
metadata-eval48.5%
neg-mul-148.5%
+-commutative48.5%
unsub-neg48.5%
Simplified48.5%
Taylor expanded in a around 0 31.6%
Final simplification31.6%
(FPCore (r a b) :precision binary64 (* b r))
double code(double r, double a, double b) {
return b * r;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = b * r
end function
public static double code(double r, double a, double b) {
return b * r;
}
def code(r, a, b): return b * r
function code(r, a, b) return Float64(b * r) end
function tmp = code(r, a, b) tmp = b * r; end
code[r_, a_, b_] := N[(b * r), $MachinePrecision]
\begin{array}{l}
\\
b \cdot r
\end{array}
Initial program 72.9%
associate-*r/72.9%
*-commutative72.9%
+-commutative72.9%
Simplified72.9%
Taylor expanded in b around 0 47.6%
Taylor expanded in a around 0 30.9%
Final simplification30.9%
herbie shell --seed 2023200
(FPCore (r a b)
:name "rsin A (should all be same)"
:precision binary64
(/ (* r (sin b)) (cos (+ a b))))