
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) (PI)))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) (PI)))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
(FPCore (a b angle) :precision binary64 (+ (pow (* a (pow (pow (sin (* (PI) (/ angle 180.0))) -1.0) -1.0)) 2.0) (pow (* b (cos (* (* (PI) 0.005555555555555556) angle))) 2.0)))
\begin{array}{l}
\\
{\left(a \cdot {\left({\sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{-1}\right)}^{-1}\right)}^{2} + {\left(b \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right)\right)}^{2}
\end{array}
Initial program 78.8%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6478.9
Applied rewrites78.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6478.9
rem-exp-logN/A
lift-log.f64N/A
*-rgt-identityN/A
lift-*.f64N/A
sinh-+-coshN/A
lift-cosh.f64N/A
lift-sinh.f64N/A
flip-+N/A
Applied rewrites78.9%
Final simplification78.9%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (cos (* (* (PI) 0.005555555555555556) angle))) 2.0)))
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right)\right)}^{2}
\end{array}
Initial program 78.8%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6478.9
Applied rewrites78.9%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (* 0.005555555555555556 (PI)) angle))) 2.0) (pow (* b (cos (* (* (PI) 0.005555555555555556) angle))) 2.0)))
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\left(0.005555555555555556 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)\right)}^{2} + {\left(b \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right)\right)}^{2}
\end{array}
Initial program 78.8%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6478.9
Applied rewrites78.9%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
rem-exp-logN/A
rem-exp-logN/A
exp-sumN/A
+-commutativeN/A
lower-sin.f64N/A
+-commutativeN/A
exp-sumN/A
rem-exp-logN/A
rem-exp-logN/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6478.9
Applied rewrites78.9%
Final simplification78.9%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) (PI)))) 2.0) (pow (* b 1.0) 2.0)))
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}
\end{array}
Initial program 78.8%
Taylor expanded in angle around 0
Applied rewrites78.6%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (* 0.005555555555555556 (PI)) angle))) 2.0) (pow (* b 1.0) 2.0)))
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\left(0.005555555555555556 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}
\end{array}
Initial program 78.8%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6478.9
Applied rewrites78.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6478.9
rem-exp-logN/A
lift-log.f64N/A
*-rgt-identityN/A
lift-*.f64N/A
sinh-+-coshN/A
lift-cosh.f64N/A
lift-sinh.f64N/A
flip-+N/A
Applied rewrites78.9%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6478.9
Applied rewrites78.9%
Taylor expanded in angle around 0
Applied rewrites78.6%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (PI) (PI))))
(if (<= b 9.2e-153)
(* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) t_0)
(if (<= b 1.26e+149)
(+
(* (* (* angle angle) 3.08641975308642e-5) (* (* t_0 a) a))
(pow (* b (sin (fma (PI) (/ angle 180.0) (/ (PI) 2.0)))) 2.0))
(sqrt (pow b 4.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;b \leq 9.2 \cdot 10^{-153}:\\
\;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot t\_0\\
\mathbf{elif}\;b \leq 1.26 \cdot 10^{+149}:\\
\;\;\;\;\left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(t\_0 \cdot a\right) \cdot a\right) + {\left(b \cdot \sin \left(\mathsf{fma}\left(\mathsf{PI}\left(\right), \frac{angle}{180}, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{b}^{4}}\\
\end{array}
\end{array}
if b < 9.19999999999999988e-153Initial program 79.2%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites44.8%
Taylor expanded in a around inf
Applied rewrites46.9%
Applied rewrites48.9%
if 9.19999999999999988e-153 < b < 1.26000000000000005e149Initial program 70.5%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-/.f6470.4
Applied rewrites70.4%
Taylor expanded in angle around 0
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6458.1
Applied rewrites58.1%
if 1.26000000000000005e149 < b Initial program 93.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6490.4
Applied rewrites90.4%
Applied rewrites92.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (PI) (PI))))
(if (<= b 9.2e-153)
(* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) t_0)
(if (<= b 1.26e+149)
(+
(* (* (* angle angle) 3.08641975308642e-5) (* (* t_0 a) a))
(pow (* b (cos (* (* (PI) 0.005555555555555556) angle))) 2.0))
(sqrt (pow b 4.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;b \leq 9.2 \cdot 10^{-153}:\\
\;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot t\_0\\
\mathbf{elif}\;b \leq 1.26 \cdot 10^{+149}:\\
\;\;\;\;\left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(t\_0 \cdot a\right) \cdot a\right) + {\left(b \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{b}^{4}}\\
\end{array}
\end{array}
if b < 9.19999999999999988e-153Initial program 79.2%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites44.8%
Taylor expanded in a around inf
Applied rewrites46.9%
Applied rewrites48.9%
if 9.19999999999999988e-153 < b < 1.26000000000000005e149Initial program 70.5%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6470.5
Applied rewrites70.5%
Taylor expanded in angle around 0
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6458.0
Applied rewrites58.0%
if 1.26000000000000005e149 < b Initial program 93.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6490.4
Applied rewrites90.4%
Applied rewrites92.4%
(FPCore (a b angle)
:precision binary64
(if (<= b 9.2e-153)
(* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) (* (PI) (PI)))
(if (<= b 1.26e+149)
(fma
(* (* (* 3.08641975308642e-5 (* angle angle)) (PI)) (PI))
(* a a)
(pow (* (cos (* (* 0.005555555555555556 (PI)) angle)) b) 2.0))
(sqrt (pow b 4.0)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.2 \cdot 10^{-153}:\\
\;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{elif}\;b \leq 1.26 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot angle\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right), a \cdot a, {\left(\cos \left(\left(0.005555555555555556 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right) \cdot b\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{b}^{4}}\\
\end{array}
\end{array}
if b < 9.19999999999999988e-153Initial program 79.2%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites44.8%
Taylor expanded in a around inf
Applied rewrites46.9%
Applied rewrites48.9%
if 9.19999999999999988e-153 < b < 1.26000000000000005e149Initial program 70.5%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6470.5
Applied rewrites70.5%
lift-+.f64N/A
Applied rewrites64.9%
Taylor expanded in angle around 0
associate-*r*N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6458.0
Applied rewrites58.0%
if 1.26000000000000005e149 < b Initial program 93.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6490.4
Applied rewrites90.4%
Applied rewrites92.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (PI) (PI))))
(if (<= b 9.2e-153)
(* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) t_0)
(if (<= b 1.26e+149)
(fma (* (* (* 3.08641975308642e-5 t_0) a) a) (* angle angle) (* b b))
(sqrt (pow b 4.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;b \leq 9.2 \cdot 10^{-153}:\\
\;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot t\_0\\
\mathbf{elif}\;b \leq 1.26 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot t\_0\right) \cdot a\right) \cdot a, angle \cdot angle, b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{b}^{4}}\\
\end{array}
\end{array}
if b < 9.19999999999999988e-153Initial program 79.2%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites44.8%
Taylor expanded in a around inf
Applied rewrites46.9%
Applied rewrites48.9%
if 9.19999999999999988e-153 < b < 1.26000000000000005e149Initial program 70.5%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites56.6%
Taylor expanded in a around inf
Applied rewrites58.2%
if 1.26000000000000005e149 < b Initial program 93.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6490.4
Applied rewrites90.4%
Applied rewrites92.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (PI) (PI))))
(if (<= b 9.2e-153)
(* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) t_0)
(if (<= b 1.15e+154)
(fma (* (* (* 3.08641975308642e-5 t_0) a) a) (* angle angle) (* b b))
(* b b)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;b \leq 9.2 \cdot 10^{-153}:\\
\;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot t\_0\\
\mathbf{elif}\;b \leq 1.15 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot t\_0\right) \cdot a\right) \cdot a, angle \cdot angle, b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 9.19999999999999988e-153Initial program 79.2%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites44.8%
Taylor expanded in a around inf
Applied rewrites46.9%
Applied rewrites48.9%
if 9.19999999999999988e-153 < b < 1.15e154Initial program 68.7%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites55.0%
Taylor expanded in a around inf
Applied rewrites56.7%
if 1.15e154 < b Initial program 100.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
(FPCore (a b angle) :precision binary64 (if (<= a 3.2e+124) (* b b) (* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) (* (PI) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.2 \cdot 10^{+124}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
if a < 3.19999999999999993e124Initial program 75.9%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
if 3.19999999999999993e124 < a Initial program 92.1%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites55.6%
Taylor expanded in a around inf
Applied rewrites79.5%
Applied rewrites81.5%
(FPCore (a b angle) :precision binary64 (if (<= a 3.2e+124) (* b b) (* (* 3.08641975308642e-5 (* (* angle a) (* angle a))) (* (PI) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.2 \cdot 10^{+124}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(angle \cdot a\right) \cdot \left(angle \cdot a\right)\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
if a < 3.19999999999999993e124Initial program 75.9%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
if 3.19999999999999993e124 < a Initial program 92.1%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites55.6%
Taylor expanded in a around inf
Applied rewrites79.5%
Applied rewrites81.5%
(FPCore (a b angle) :precision binary64 (if (<= a 3.2e+124) (* b b) (* (* 3.08641975308642e-5 (* a (* (* a angle) angle))) (* (PI) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.2 \cdot 10^{+124}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\left(a \cdot angle\right) \cdot angle\right)\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
if a < 3.19999999999999993e124Initial program 75.9%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
if 3.19999999999999993e124 < a Initial program 92.1%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites55.6%
Taylor expanded in a around inf
Applied rewrites79.5%
(FPCore (a b angle) :precision binary64 (if (<= a 3.2e+124) (* b b) (* (* 3.08641975308642e-5 a) (* (* (* angle a) angle) (* (PI) (PI))))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.2 \cdot 10^{+124}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot \left(\left(\left(angle \cdot a\right) \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\\
\end{array}
\end{array}
if a < 3.19999999999999993e124Initial program 75.9%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
if 3.19999999999999993e124 < a Initial program 92.1%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites55.6%
Taylor expanded in a around inf
Applied rewrites79.5%
Applied rewrites79.5%
(FPCore (a b angle) :precision binary64 (if (<= a 3.2e+124) (* b b) (* (* 3.08641975308642e-5 (* a a)) (* (* (* angle angle) (PI)) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.2 \cdot 10^{+124}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right) \cdot \left(\left(\left(angle \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
if a < 3.19999999999999993e124Initial program 75.9%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
if 3.19999999999999993e124 < a Initial program 92.1%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites55.6%
Taylor expanded in a around inf
Applied rewrites79.5%
Taylor expanded in a around 0
Applied rewrites66.6%
(FPCore (a b angle) :precision binary64 (* b b))
double code(double a, double b, double angle) {
return b * b;
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = b * b
end function
public static double code(double a, double b, double angle) {
return b * b;
}
def code(a, b, angle): return b * b
function code(a, b, angle) return Float64(b * b) end
function tmp = code(a, b, angle) tmp = b * b; end
code[a_, b_, angle_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
\\
b \cdot b
\end{array}
Initial program 78.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6452.3
Applied rewrites52.3%
herbie shell --seed 2024340
(FPCore (a b angle)
:name "ab-angle->ABCF A"
:precision binary64
(+ (pow (* a (sin (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (cos (* (/ angle 180.0) (PI)))) 2.0)))